Aggregate functions

Standard statistics calculations for streaming event windows

Objective

Joule provides a set of standard aggregate functions that can be applied to a set of events within a triggered window.

These are processed using the group by definition provided with the use case.

Example

processing unit:
  pipeline:
    - time window:
        emitting type: tumblingAggregatesAnalytics
        aggregate functions:
          FIRST: [ask,bid]
          LAST: [ ask,bid ]
          MIN: [ ask,bid ]
          MAX: [ ask,bid ]
          SUM: [ volume ]
          MEAN: [ volatility ]
          VARIANCE: [ volatility ]
          STDEV: [ volatility ]
        policy:
          type: tumblingTime
          window size: 5000

This will produce the defined set of aggregate values and add these to the emitting event. For example these attributes will be added to the event:

  • ask_FIRST and bid_FIRST

  • ask_LAST and bid_LAST

  • volatility_MEAN

  • etc;.

Available aggregate functions

When the function applied the field the result is added in the returned stream events as an additional field i.e. <field_name>_SUM

TypeDescription

SUM

Sum of field values

MIN

Min of field value

MAX

Max of field value

MEAN

Mean of field value

VARIANCE

Variance of field value

STDEV

Standard deviation of field value

FIRST

First field value in window

LAST

Last field value in window

HARMONIC_MEAN

Harmonic mean of field value

GEOMETRIC_MEAN

Geometric mean of field value

PVARIANCE

Population variance of field value

SECOND_MOMENT

Seond moment of field value

SUM_SQRTS

Sum of square root of field value

SUM_LOGS

Sum of log of field value

Last updated