Skip to content

Commit 533fdfd

Browse files
committed
More logging of expression rewriting for GeneratedAggregate.
1 parent 3cd773e commit 533fdfd

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

sql/core/src/main/scala/org/apache/spark/sql/execution/GeneratedAggregate.scala

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,28 @@ case class GeneratedAggregate(
128128

129129
child.execute().mapPartitions { iter =>
130130
// Builds a new custom class for holding the results of aggregation for a group.
131-
val newAggregationBuffer =
132-
newProjection(computeFunctions.flatMap(_.initialValues), child.output)
131+
val initialValues = computeFunctions.flatMap(_.initialValues)
132+
val newAggregationBuffer = newProjection(initialValues, child.output)
133+
logger.info(s"Initial values: ${initialValues.mkString(",")}")
134+
135+
// A projection that computes the group given an input tuple.
136+
val groupProjection = newProjection(groupingExpressions, child.output)
137+
logger.info(s"Grouping Projection: ${groupingExpressions.mkString(",")}")
133138

134139
// A projection that is used to update the aggregate values for a group given a new tuple.
135140
// This projection should be targeted at the current values for the group and then applied
136141
// to a joined row of the current values with the new input row.
137-
val updateProjection =
138-
newMutableProjection(
139-
computeFunctions.flatMap(_.update),
140-
computeFunctions.flatMap(_.schema) ++ child.output)()
141-
142-
// A projection that computes the group given an input tuple.
143-
val groupProjection = newProjection(groupingExpressions, child.output)
142+
val updateExpressions = computeFunctions.flatMap(_.update)
143+
val updateSchema = computeFunctions.flatMap(_.schema) ++ child.output
144+
val updateProjection = newMutableProjection(updateExpressions, updateSchema)()
145+
logger.info(s"Update Expressions: ${updateExpressions.mkString(",")}")
144146

145147
// A projection that produces the final result, given a computation.
146148
val resultProjectionBuilder =
147149
newMutableProjection(
148150
resultExpressions,
149151
(namedGroups.map(_._2.toAttribute) ++ computationSchema).toSeq)
152+
logger.info(s"Result Projection: ${resultExpressions.mkString(",")}")
150153

151154
val joinedRow = new JoinedRow
152155

0 commit comments

Comments
 (0)