Processing Methods for Aggregate Functions - 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 typical aggregate function (non-decomposable) should implement the processing methods aggregateRow, getFinalValue, and reset, in addition to those related to custom context, in the following structure:

struct UdfAggregatorFunctionPointers
{
void* customContext;

void (*releaseCustomContext)(
        void* customContext
);

SqlmrErrorH (*aggregateRow)(
        SqlmrTaskContextH taskContext,
        void* customContext,
        SqlmrRowViewH input
) SQLMR_ERROR_RESULT;

SqlmrErrorH (*getFinalValue)(
        SqlmrTaskContextH taskContext,
        void* customContext,
        SqlmrValueHolderH outValueHolder
) SQLMR_ERROR_RESULT;

SqlmrErrorH (*reset)(
        SqlmrTaskContextH taskContext,
        void* customContext
) SQLMR_ERROR_RESULT;
};

The following table describes the member variables or methods used in the structure above:

Member Variables or Methods
Member Name Type Description
customContext variable Points to a scratch store that holds temporary data needed by the function. For example, this storage may contain running values or partial values for the function.
releaseCustomContext method Releases the resources held by customContext. This function must be set only if customContext is set.
aggregateRow method Performs processing on all rows.
getFinalValue method Returns to final output.
reset method Resets the aggregate to its initial state.