Skip to content

AggregationIterator -- Generic Iterator of UnsafeRows for Aggregate Physical Operators

AggregationIterator is the base for <> of <> that...FIXME

Iterators are data structures that allow to iterate over a sequence of elements. They have a hasNext method for checking if there is a next element available, and a next method which returns the next element and discards it from the iterator.

[[implementations]] .AggregationIterator's Implementations [width="100%",cols="1,2",options="header"] |=== | Name | Description

| ObjectAggregationIterator | Used when ObjectHashAggregateExec physical operator is executed

| SortBasedAggregationIterator | Used when SortAggregateExec physical operator is executed

| TungstenAggregationIterator a| Used when HashAggregateExec physical operator is executed


[[internal-registries]] .AggregationIterator's Internal Registries and Counters [cols="1,2",options="header",width="100%"] |=== | Name | Description

| [[aggregateFunctions]] aggregateFunctions | Aggregate functions

Used when...FIXME

| [[allImperativeAggregateFunctions]] allImperativeAggregateFunctions | ImperativeAggregate functions

Used when...FIXME

| [[allImperativeAggregateFunctionPositions]] allImperativeAggregateFunctionPositions | Positions

Used when...FIXME

| [[expressionAggInitialProjection]] expressionAggInitialProjection | MutableProjection

Used when...FIXME

| generateOutput a| [[generateOutput]] Function used to generate an unsafe row (i.e. (UnsafeRow, InternalRow) => UnsafeRow)

Used when:

| [[groupingAttributes]] groupingAttributes | Grouping attributes

Used when...FIXME

| [[groupingProjection]] groupingProjection | UnsafeProjection

Used when...FIXME

| [[processRow]] processRow | (InternalRow, InternalRow) => Unit

Used when...FIXME |===

Creating Instance

AggregationIterator takes the following when created:

  • [[groupingExpressions]] Grouping named expressions
  • [[inputAttributes]] Input attributes
  • [[aggregateExpressions]] Aggregate expressions
  • [[aggregateAttributes]] Aggregate attributes
  • [[initialInputBufferOffset]] Initial input buffer offset
  • [[resultExpressions]] Result named expressions
  • [[newMutableProjection]] Function to create a new MutableProjection given expressions and attributes


AggregationIterator is a Scala abstract class and cannot be created directly. It is created indirectly for the concrete AggregationIterators.

=== [[initializeAggregateFunctions]] initializeAggregateFunctions Internal Method

[source, scala]

initializeAggregateFunctions( expressions: Seq[AggregateExpression], startingInputBufferOffset: Int): Array[AggregateFunction]


NOTE: initializeAggregateFunctions is used when...FIXME

=== [[generateProcessRow]] generateProcessRow Internal Method

[source, scala]

generateProcessRow( expressions: Seq[AggregateExpression], functions: Seq[AggregateFunction], inputAttributes: Seq[Attribute]): (InternalRow, InternalRow) => Unit


NOTE: generateProcessRow is used when...FIXME

=== [[generateResultProjection]] generateResultProjection Method

[source, scala]

generateResultProjection(): (UnsafeRow, InternalRow) => UnsafeRow



generateResultProjection is used when:

  • AggregationIterator is <>

* TungstenAggregationIterator is requested for the <>

Last update: 2021-03-18