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); }