-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-18016][SQL] Code Generation: Constant Pool Limit - reduce entries for mutable state #19811
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
Changes from 1 commit
d441794
870d106
24d7087
3eb5842
074d711
eafa3f8
90d15f3
c456c07
9ca5ab3
5b36c61
fd51d75
effe918
9df109c
634d494
d3438fd
f4f3754
f1e1fca
0937ef2
4bfcc1a
49119a9
24f49c5
15e967e
d6c1a97
a9d40e9
31914c0
0e45c19
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,11 +203,16 @@ class CodegenContext { | |
| useFreshName: Boolean = true): String = { | ||
| val varName = if (useFreshName) freshName(variableName) else variableName | ||
|
||
| val initCode = codeFunctions(varName) | ||
| if (javaType.contains("[][]")) { | ||
| Thread.dumpStack() | ||
| } | ||
|
|
||
| if (inline || | ||
|
||
| // want to put a primitive type variable at outerClass for performance | ||
| isPrimitiveType(javaType) && | ||
| (mutableStates.length < CodeGenerator.OUTER_CLASS_VARIABLES_THRESHOLD)) { | ||
| (mutableStates.length < CodeGenerator.OUTER_CLASS_VARIABLES_THRESHOLD) || | ||
| // type is multi-dimensional array | ||
|
||
| javaType.contains("[][]")) { | ||
| mutableStates += ((javaType, varName, initCode)) | ||
| varName | ||
| } else { | ||
|
|
||
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.
instead of calling
freshNamehere and adding auseFreshNameparameter, can we follow the previous style and ask the caller side to guarantee the given name is unique? i.e. callfreshNameat caller sideThere 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.
Since I noticed that most of caller sides executes
freshName, I decided to use the new style that can simply caller code. If a developer want to guarantee the given name is unique at caller site (currently, they are only several cases), it is OK by usinguseFreshName = true.Do we need redundant code at caller side? WDYT? @cloud-fan
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.
isn't it an existing problem? Let's fix it in another PR to make this PR more consistent with the previous code.
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.
Sure, let us discuss in another PR.