-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-18016][SQL][FOLLOW-UP] Code Generation: Constant Pool Limit - reduce entries for mutable state #20036
Conversation
Test build #85196 has finished for PR 20036 at commit
|
Jenkins, retest this please |
Test build #85224 has finished for PR 20036 at commit
|
Jenkins, retest this please |
Test build #85236 has finished for PR 20036 at commit
|
retest this please |
Test build #85260 has finished for PR 20036 at commit
|
val pattern = ctx.addMutableState(patternClass, "patternLike", | ||
v => s"""$v = ${patternClass}.compile("$regexStr");""", forceInline = true) | ||
v => s"""$v = ${patternClass}.compile("$regexStr");""") |
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: we can remove {
and }
around patternClass
.
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, done for other places, too.
val pattern = ctx.addMutableState(patternClass, "patternRLike", | ||
v => s"""$v = ${patternClass}.compile("$regexStr");""", forceInline = true) | ||
v => s"""$v = ${patternClass}.compile("$regexStr");""") |
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.
ditto.
Test build #85300 has finished for PR 20036 at commit
|
retest this please |
Test build #85301 has finished for PR 20036 at commit
|
retest this please |
Test build #85307 has finished for PR 20036 at commit
|
ping @cloud-fan |
@@ -283,7 +283,7 @@ case class InputAdapter(child: SparkPlan) extends UnaryExecNode with CodegenSupp | |||
|
|||
override def doProduce(ctx: CodegenContext): String = { | |||
// Right now, InputAdapter is only used when there is one input RDD. | |||
// inline mutable state since an inputAdaptor in a task | |||
// inline mutable state since an InputAdapter in a task |
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.
you miss some words...
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, done
@@ -299,7 +299,7 @@ class CodegenContext { | |||
def initMutableStates(): String = { | |||
// It's possible that we add same mutable state twice, e.g. the `mergeExpressions` in | |||
// `TypedAggregateExpression`, we should call `distinct` here to remove the duplicated ones. | |||
val initCodes = mutableStateInitCode.distinct | |||
val initCodes = mutableStateInitCode.distinct.map(_ + "\n") |
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.
ah, good catch!
LGTM |
Test build #85423 has finished for PR 20036 at commit
|
@@ -283,7 +283,7 @@ case class InputAdapter(child: SparkPlan) extends UnaryExecNode with CodegenSupp | |||
|
|||
override def doProduce(ctx: CodegenContext): String = { | |||
// Right now, InputAdapter is only used when there is one input RDD. | |||
// inline mutable state since an inputAdaptor in a task | |||
// inline mutable state since an InputAdapter is used once in a task for WholeStageCodegen |
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: inline
-> Inline
@@ -440,8 +440,9 @@ case class SortMergeJoinExec( | |||
val spillThreshold = getSpillThreshold | |||
val inMemoryThreshold = getInMemoryThreshold | |||
|
|||
// inline mutable state since not many join operations in a task |
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: Inline
} else { | ||
val generatedMap = new RowBasedHashMapGenerator(ctx, aggregateExpressions, | ||
fastHashMapClassName, groupingKeySchema, bufferSchema).generate() | ||
ctx.addInnerClass(generatedMap) | ||
|
||
// inline mutable state since not many aggregation operations in a task |
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: Inline
@@ -587,20 +587,24 @@ case class HashAggregateExec( | |||
fastHashMapClassName, groupingKeySchema, bufferSchema).generate() | |||
ctx.addInnerClass(generatedMap) | |||
|
|||
// inline mutable state since not many aggregation operations in a task |
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: Inline
LGTM |
Test build #85430 has finished for PR 20036 at commit
|
thanks, merging to master! |
What changes were proposed in this pull request?
This PR addresses additional review comments in #19811
How was this patch tested?
Existing test suites