-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CALCITE-6348] ARRAY_OVERLAP with a NULL argument crashes the compiler #3746
Conversation
@@ -7126,6 +7126,9 @@ void checkRegexpExtract(SqlOperatorFixture f0, FunctionAlias functionAlias) { | |||
"Cannot apply 'ARRAYS_OVERLAP' to arguments of type 'ARRAYS_OVERLAP\\(" | |||
+ "<INTEGER ARRAY>, <BOOLEAN>\\)'. Supported form\\(s\\): 'ARRAYS_OVERLAP\\(" | |||
+ "<EQUIVALENT_TYPE>, <EQUIVALENT_TYPE>\\)'", false); | |||
f.checkNull("arrays_overlap(null, null)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihaibudiu Are you sure spark supports this writing method? My test failed in spark 3.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what you mean by that. This is a legal expression which shouldn't crash the compiler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what you mean by that. This is a legal expression which shouldn't crash the compiler.
It seems to be a bug in spark. I can help you test it on the latest code branch of spark to see if it can be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mihaibudiu I tested it on the spark master branch. It seems that the parameters in arrays_overlap are not allowed to be null, which will fail at compile time
Is this a bug in spark sql?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which program crashes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoever wrote that code is confusing the type "NULL" with the type "VOID". These are not the same thing at all. NULL is a type which has one value, whereas VOID has no values at all.
So there is at least one bug in their handling of types.
We can also reject this expression at compilation time in Calcite.
What happens if both arrays are NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then it's easy, we just reject arguments of type NULL for this function.
I will rework the implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Mihai Budiu <[email protected]>
Quality Gate passedIssues Measures |
No description provided.