rollup()

Combines multiple StateAgg/TimelineAgg aggregates. Using rollup, you can reaggregate a continuous aggregate into larger time buckets.

  1. rollup(
  2. agg [StateAgg | TimelineAgg]
  3. ) RETURNS [StateAgg | TimelineAgg]
warning

Experimental features could have bugs. They might not be backwards compatible, and could be removed in future releases. Use these features at your own risk, and do not use any experimental features in production.

Required arguments

NameTypeDescription
aggStateAgg or TimelineAggThe aggregates to roll up

Returns

ColumnTypeDescription
aggStateAgg or TimelineAggA new aggregate containing the combined rolled-up aggregates.

Sample usage

  1. WITH buckets AS (SELECT
  2. time_bucket('1 minute', ts) as dt,
  3. toolkit_experimental.state_agg(ts, state) AS sa
  4. FROM states_test
  5. GROUP BY time_bucket('1 minute', ts))
  6. SELECT toolkit_experimental.duration_in(
  7. 'START',
  8. toolkit_experimental.rollup(buckets.sa)
  9. )
  10. FROM buckets;