Operator Functions: aggregateRow and aggregatePartialRow - Aster Execution Engine

Teradata Aster® Developer Guide

Product
Aster Execution Engine
Release Number
7.00.02
Published
July 2017
Language
English (United States)
Last Update
2018-04-13
dita:mapPath
xnl1494366523182.ditamap
dita:ditavalPath
Generic_no_ie_no_tempfilter.ditaval
dita:id
ffu1489104705746
lifecycle
previous
Product Category
Software

A DecomposableAggregatorFunction must implement aggregateRow and aggregateParialRow methods.The aggregateRow computes partial results from input rows and the aggregateParialRow computes final results from partial results. The function is given a RowView, which is an abstract of table row. This row is provided by RowIterator and is run by the aggregate execution engine. These functions do not return any value. You should define an instance variable to store the partial and final results. The partial result should be in the type RowHolder and final result should be ValueHolder. You should implement the method to update partial and final results based on each new row input until the end of the current partition.

Below is an example of a simple function that counts the number of rows for each input partition. The aggregateRow method computes partial counts from the input row and the aggregatePartialRow method computes final counts from partial counts.

// Count the input row.
public void aggregateRow(RowView row) {
   count_++;
}

// Aggregate the first attribute of the input row.
public void aggregatePartialRow(RowView partialRow) {
   count_ += partialRow.getLongAt(0);
}