AggregateFunction Expressions¶
AggregateFunction is an extension of the Expression abstraction for aggregate functions.
AggregateFunction can never be foldable.
Contract¶
Aggregation Buffer Attributes¶
Aggregation Buffer Schema¶
Schema of an aggregation buffer with partial aggregate results
Used when:
AggregationIteratoris requested to initializeAggregateFunctions
inputAggBufferAttributes¶
Implementations¶
- DeclarativeAggregate
- ImperativeAggregate
TypedAggregateExpression
foldable¶
foldable is always disabled (false).
Converting into AggregateExpression¶
toAggregateExpression(): AggregateExpression // (1)
toAggregateExpression(
isDistinct: Boolean,
filter: Option[Expression] = None): AggregateExpression
isDistinctflag isfalse
toAggregateExpression creates an AggregateExpression for this AggregateFunction (with Complete mode).
import org.apache.spark.sql.catalyst.expressions.aggregate.AggregateExpression
val aggFn = fn.expr.asInstanceOf[AggregateExpression].aggregateFunction
toAggregateExpression is used when:
AggregateFunctionis requested to toAggregateExpressionfunctionsutility is used to withAggregateFunction- others