Aggregate AE examples
The aggregate AE examples show an aggregate function that returns the maximum value from a set of values (except for Fortran, which returns the second highest value). The examples use four methods: accumulate, initializeState, merge, and finalResult. These methods mirror the standard UDA methods.
In the example, the AE determines the next aggregation state from the API. Depending on the next aggregation state, the initialization, accumulation, merge or finalResult functions are called. These functions must be overridden by a user while they are implementing an aggregate AE. The initialization function sets the state variable as defined in the registration step to a default value. The accumulate step compares the first column of each row with the state variable. If the column value is greater than the state variable, the state variable is set to the column value. The merge step merges the state variable that is collected from each data slice and the final result returns the merged state variable.