maropu commented on a change in pull request #28804: URL: https://github.com/apache/spark/pull/28804#discussion_r466760439
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala ########## @@ -680,6 +688,16 @@ case class HashAggregateExec( private def doProduceWithKeys(ctx: CodegenContext): String = { val initAgg = ctx.addMutableState(CodeGenerator.JAVA_BOOLEAN, "initAgg") + if (skipPartialAggregate) { + avoidSpillInPartialAggregateTerm = ctx. + addMutableState(CodeGenerator.JAVA_BOOLEAN, + "avoidPartialAggregate", + term => s"$term = ${Utils.isTesting};") + } + val childrenConsumed = ctx. + addMutableState(CodeGenerator.JAVA_BOOLEAN, "childrenConsumed") + rowCountTerm = ctx. + addMutableState(CodeGenerator.JAVA_LONG, "rowCount") Review comment: Because of the historical reason, we avoid generating unnecesary mutable states where poissible. See: https://issues.apache.org/jira/browse/SPARK-18016 I think it is best to generate the same generated code with that in the master if `skipPartialAggregate=false`. Did you suggest it is impossible to do so? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org