-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22693][SQL] CreateNamedStruct and InSet should not use global variables #19896
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 #84484 has finished for PR 19896 at commit
|
|
@cloud-fan @kiszk @viirya may you please review this? Thanks |
| }) | ||
| valCodes, | ||
| "createNamedStruct", | ||
| "Object[]" -> values :: Nil) |
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: please keep the parameter name
ctx.splitExpressionsWithCurrentInputs(
expressions = valCodes,
funcName = ...
| ev.copy(code = | ||
| s""" | ||
| |$values = new Object[${valExprs.size}]; | ||
| |Object[] $values = new Object[${valExprs.size}]; |
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.
actually I'm not very sure about this. The previous code can avoid creating this array every time.
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.
oh it didn't, but it can, you know my point...
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.
why? It is creating it every time (new Object[${valExprs.size}]), the only thing which is reused is the pointer to the array.
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 mean it can reuse the array...
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 see what you mean now. Since currently this is not done, what should we do? Should I create a new PR to reuse the array and remove this from here?
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 sounds good
|
Test build #84546 has finished for PR 19896 at commit
|
|
LGTM |
|
LGTM |
1 similar comment
|
LGTM |
|
Test build #84552 has finished for PR 19896 at commit
|
This reverts commit b5bd951.
|
I added back the changes for CreateNamedStruct. May you review this part again too? Thanks. |
|
LGTM |
|
Test build #84564 has finished for PR 19896 at commit
|
|
Thanks! Merged to master. |
What changes were proposed in this pull request?
CreateNamedStruct and InSet are using a global variable which is not needed. This can generate some unneeded entries in the constant pool.
The PR removes the unnecessary mutable states and makes them local variables.
How was this patch tested?
added UT