-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-35281][SQL] StaticInvoke should not apply boxing if return type is primitive #32416
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
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
| ${ev.value} = $boxedResult; | ||
| } | ||
| """ | ||
| if (method.getReturnType.isPrimitive) { |
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.
Hmm, why returnNullable is true when return type is primitive?
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.
Doesn't primitive return type go the last else block (i.e. returnNullable = 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.
I think the caller of StaticInvoke can set returnNullable to true even though the return type is primitive, so it's better to check here nevertheless. I think I can make the code simpler by reusing the else branch.
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.
Yea, if the caller sets returnNullable correctly, StaticInvoke won't box primitive return value. I agree, it is possible the caller wrongly set returnNullable to true.
|
Test build #138141 has finished for PR 32416 at commit
|
|
retest this please |
viirya
left a comment
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
|
retest this please |
|
Merged to master. |
What changes were proposed in this pull request?
In
StaticInvoke, when result is nullable, don't box the return value if its type is primitive.Why are the changes needed?
It is unnecessary to apply boxing when the method return value is of primitive type, and it would hurt performance a lot if the method is simple. The check is done in
Invokebut not inStaticInvoke.Does this PR introduce any user-facing change?
No
How was this patch tested?
Added a UT.