Skip to content

AggregateFunction Expressions

AggregateFunction is an extension of the Expression abstraction for aggregate functions.

Contract

aggBufferAttributes

aggBufferAttributes: Seq[AttributeReference]

aggBufferSchema

aggBufferSchema: StructType

Schema of an aggregation buffer with partial aggregate results

inputAggBufferAttributes

inputAggBufferAttributes: Seq[AttributeReference]

Implementations

foldable

foldable: Boolean

foldable is part of the Expression abstraction.

foldable is always false.

Converting to AggregateExpression

toAggregateExpression(): AggregateExpression // (1)
toAggregateExpression(
  isDistinct: Boolean,
  filter: Option[Expression] = None): AggregateExpression
  1. isDistinct flag is false

toAggregateExpression creates an AggregateExpression for this AggregateFunction and Complete mode.

import org.apache.spark.sql.functions.collect_list
val fn = collect_list("gid")

import org.apache.spark.sql.catalyst.expressions.aggregate.AggregateExpression
val aggFn = fn.expr.asInstanceOf[AggregateExpression].aggregateFunction

scala> println(aggFn.numberedTreeString)
00 collect_list('gid, 0, 0)
01 +- 'gid

toAggregateExpression is used when:


Last update: 2021-07-05
Back to top