Creating a user-defined aggregate

The built-in aggregates provide basic aggregations. However, if your data requires some special aggregation, you can create a custom aggregate function, called a user-defined aggregate. To implement your custom aggregation, you design an aggregate algorithm, which consists of the following parts:
  • The aggregate state, which contains the information that needs to be passed between iterations of the aggregate
  • The aggregation tasks, which are implemented as special-purpose user-defined functions called aggregate support functions