-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-25308][SQL] ArrayContains function may return a error in the code generation phase. #22315
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
Conversation
|
Test build #95586 has finished for PR 22315 at commit
|
|
retest this please |
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.
The fix LGTM, just some minor comments to address. We might want to add a test for non-nullable types to all operators. Probably we can create an helper for this in order to avoid this issue in the future. What do you think? cc @cloud-fan @gatorsmile
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.
nit: extra newline
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.
nit: spark-xxxxx?
|
Test build #95587 has finished for PR 22315 at commit
|
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.
Could you update this part based on this comment instead of if (...) { ... } else?
|
Thank you |
|
Test build #95589 has finished for PR 22315 at commit
|
|
Test build #95593 has finished for PR 22315 at commit
|
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.
How about the case right.nullable = true and
left.nullable = false AND left.dataType.asInstanceOf[ArrayType].containsNull = false?
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.
@maropu This should be rejected in checkInputDataTypes(), no ?
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.
nit: How about def checkAndSetIsNullCode(body: String) = if (nullable) {?
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.
@maropu ok..
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.
This seems too complicated to save a few duplicated code, how about
val loopBody = if (nullable) {
s"""
|if ($arr.isNullAt($i)) {
| ${ev.isNull} = true;
|} else ...
"""
} else {
s"""
|if (${ctx.genEqual(right.dataType, value, getValue)}) {...
"""
}
|
Test build #95608 has finished for PR 22315 at commit
|
|
Test build #95634 has finished for PR 22315 at commit
|
|
retest this please |
|
Test build #95636 has finished for PR 22315 at commit
|
712542c to
59ddb99
Compare
|
LGTM |
|
Test build #95638 has finished for PR 22315 at commit
|
|
LGTM. |
|
Thanks! merging to master. |
|
@dilipbiswal Could we also add the test cases for the other high-order functions, if missing? |
|
@gatorsmile Sure.. I will check and add. |
|
@dilipbiswal Do we need to backport this to 2.3? If so, could you submit a backport pr to branch-2.3 please? Thanks! |
|
@ueshin Just verified in 2.3. This problem does not exist in 2.3. This is due to the fact that implementation of nullSafeCodeGen is different in 2.3 than in master. However, we are missing the test cases we added in these PRs in 2.3. Should we have the test cases checked in into the branch ? I am afraid that if we ever backported the pr that changed nullSafeCodeGen , we may introduce this bug. Please advise .. |
|
@dilipbiswal Thanks for the verification! I don't think we will backport the |
What changes were proposed in this pull request?
Invoking ArrayContains function with non nullable array type throws the following error in the code generation phase. Below is the error snippet.
How was this patch tested?
Added test in CollectionExpressionSuite.