rollup()
Combines multiple StateAgg
/TimelineAgg
aggregates. Using rollup
, you can reaggregate a continuous aggregate into larger time buckets.
rollup(
agg [StateAgg | TimelineAgg]
) 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
Name | Type | Description |
---|---|---|
agg | StateAgg or TimelineAgg | The aggregates to roll up |
Returns
Column | Type | Description |
---|---|---|
agg | StateAgg or TimelineAgg | A new aggregate containing the combined rolled-up aggregates. |
Sample usage
WITH buckets AS (SELECT
time_bucket('1 minute', ts) as dt,
toolkit_experimental.state_agg(ts, state) AS sa
FROM states_test
GROUP BY time_bucket('1 minute', ts))
SELECT toolkit_experimental.duration_in(
'START',
toolkit_experimental.rollup(buckets.sa)
)
FROM buckets;
当前内容版权归 TimescaleDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 TimescaleDB .