AggUtils Helper Object
AggUtils
is a Scala object that defines the methods used exclusively when Aggregation execution planning strategy is executed.
planAggregateWithOneDistinct
Method
1 2 3 4 5 6 7 8 9 10 |
planAggregateWithOneDistinct( groupingExpressions: Seq[NamedExpression], functionsWithDistinct: Seq[AggregateExpression], functionsWithoutDistinct: Seq[AggregateExpression], resultExpressions: Seq[NamedExpression], child: SparkPlan): Seq[SparkPlan] |
planAggregateWithOneDistinct
…FIXME
Note
|
planAggregateWithOneDistinct is used exclusively when Aggregation execution planning strategy is executed.
|
Creating Physical Plan with Two Aggregate Physical Operators for Partial and Final Aggregations — planAggregateWithoutDistinct
Method
1 2 3 4 5 6 7 8 9 |
planAggregateWithoutDistinct( groupingExpressions: Seq[NamedExpression], aggregateExpressions: Seq[AggregateExpression], resultExpressions: Seq[NamedExpression], child: SparkPlan): Seq[SparkPlan] |
planAggregateWithoutDistinct
is a two-step physical operator generator.
planAggregateWithoutDistinct
first creates an aggregate physical operator with aggregateExpressions
in Partial
mode (for partial aggregations).
Note
|
requiredChildDistributionExpressions for the aggregate physical operator for partial aggregation “stage” is empty.
|
In the end, planAggregateWithoutDistinct
creates another aggregate physical operator (of the same type as before), but aggregateExpressions
are now in Final
mode (for final aggregations). The aggregate physical operator becomes the parent of the first aggregate operator.
Note
|
requiredChildDistributionExpressions for the parent aggregate physical operator for final aggregation “stage” are the attributes of groupingExpressions .
|
Creating Aggregate Physical Operator — createAggregate
Internal Method
1 2 3 4 5 6 7 8 9 10 11 12 |
createAggregate( requiredChildDistributionExpressions: Option[Seq[Expression]] = None, groupingExpressions: Seq[NamedExpression] = Nil, aggregateExpressions: Seq[AggregateExpression] = Nil, aggregateAttributes: Seq[Attribute] = Nil, initialInputBufferOffset: Int = 0, resultExpressions: Seq[NamedExpression] = Nil, child: SparkPlan): SparkPlan |
createAggregate
creates a physical operator given the input aggregateExpressions
aggregate expressions.
Aggregate Physical Operator | Selection Criteria |
---|---|
|
|
|
|
When all the above requirements could not be met. |
Note
|
createAggregate is used when AggUtils is requested to planAggregateWithoutDistinct, planAggregateWithOneDistinct (and planStreamingAggregation for Spark Structured Streaming)
|