diff --git a/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala b/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala index e55d6b0fabca8..bdfa44adf602e 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala @@ -128,25 +128,28 @@ case class GeneratedAggregate( child.execute().mapPartitions { iter => // Builds a new custom class for holding the results of aggregation for a group. - val newAggregationBuffer = - newProjection(computeFunctions.flatMap(_.initialValues), child.output) + val initialValues = computeFunctions.flatMap(_.initialValues) + val newAggregationBuffer = newProjection(initialValues, child.output) + logger.info(s"Initial values: ${initialValues.mkString(",")}") + + // A projection that computes the group given an input tuple. + val groupProjection = newProjection(groupingExpressions, child.output) + logger.info(s"Grouping Projection: ${groupingExpressions.mkString(",")}") // A projection that is used to update the aggregate values for a group given a new tuple. // This projection should be targeted at the current values for the group and then applied // to a joined row of the current values with the new input row. - val updateProjection = - newMutableProjection( - computeFunctions.flatMap(_.update), - computeFunctions.flatMap(_.schema) ++ child.output)() - - // A projection that computes the group given an input tuple. - val groupProjection = newProjection(groupingExpressions, child.output) + val updateExpressions = computeFunctions.flatMap(_.update) + val updateSchema = computeFunctions.flatMap(_.schema) ++ child.output + val updateProjection = newMutableProjection(updateExpressions, updateSchema)() + logger.info(s"Update Expressions: ${updateExpressions.mkString(",")}") // A projection that produces the final result, given a computation. val resultProjectionBuilder = newMutableProjection( resultExpressions, (namedGroups.map(_._2.toAttribute) ++ computationSchema).toSeq) + logger.info(s"Result Projection: ${resultExpressions.mkString(",")}") val joinedRow = new JoinedRow