Support functions
- INIT
- Initializes the data structures required for computing the aggregate
- ITER
- Merges a single (row) value with the previous partial result
- COMBINE
- Merges one partial result with another partial result, thus allowing parallel execution of the aggregate
- FINAL
- Converts the partial result into the final value
It can perform cleanup operations and release resources.
You can write the support functions in SPL, C, or Java™. For information about SPL, refer to the HCL OneDB™ Guide to SQL: Syntax. For information about writing functions in external languages, refer to the HCL OneDB DataBlade® API Programmer's Guide or the HCL® J/Foundation Developer's Guide.
CREATE AGGREGATE sumsq
(INIT = init_func,
ITER = iter_func,
COMBINE = combine_func,
FINAL = final_func);
When you create a user-defined aggregate, you must overload each support function to provide for each data type on which the aggregate will operate. That is, if you create a new aggregate, SUMSQ, whose iterator function is iter_func, you must overload the iter_func function for each applicable data type. Aggregate names are not case sensitive. When you create and use an aggregate, you can use either uppercase or lowercase.