Skip to content

Commit

Permalink
More logging of expression rewriting for GeneratedAggregate.
Browse files Browse the repository at this point in the history
  • Loading branch information
marmbrus committed Jul 27, 2014
1 parent 3cd773e commit 533fdfd
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 533fdfd

Please sign in to comment.