rednaxelafx commented on a change in pull request #20965: [SPARK-21870][SQL]
Split aggregation code into small functions
URL: https://github.com/apache/spark/pull/20965#discussion_r316414820
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/HashAggregateExec.scala
##########
@@ -255,6 +255,41 @@ case class HashAggregateExec(
""".stripMargin
}
+ // Splits aggregate code into small functions because the most of JVM
implementations
+ // can not compile too long functions. Note that different from
`CodeGenerator.splitExpressions`,
+ // we will extract input variables from references and subexpression
elimination states
+ // for each aggregate expression, then pass them to it.
+ private def splitAggregateExpressions(
+ context: CodegenContext,
+ aggregateExpressions: Seq[Expression],
+ codes: Seq[String],
+ subExprs: Map[Expression, SubExprEliminationState],
+ bufferInput: Option[(String, DataType)] = None): Seq[String] = {
+ aggregateExpressions.zipWithIndex.map { case (aggExpr, i) =>
Review comment:
Looks like we can just do `aggregateExpressions.zip(codes).map { case
(aggExpr, aggEvalCode) =>` here? I don't see any other use of `i` below other
than `codes(i)`.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]