rollup()
Combine multiple timevectors into a single timevector for re-aggregation
Early access 1.3.0
Combine multiple pre-constructed timevectors into a single timevector. This is useful for re-aggregating timevectors that were created separately, such as when grouping by different dimensions or combining data from multiple sources.
Samples
Section titled “Samples”Combine timevectors from different groups
Section titled “Combine timevectors from different groups”Aggregate per-device timevectors into a single combined timevector:
CREATE TABLE samples(time TIMESTAMPTZ, batch INT, data DOUBLE PRECISION);
-- Create timevectors per batchCREATE VIEW batch_series AS SELECT batch, timevector(time, data) AS batch_series FROM samples GROUP BY batch;
-- Combine all batches into one timevectorSELECT rollup(batch_series)FROM batch_series;Re-aggregate across partitions
Section titled “Re-aggregate across partitions”Combine timevectors from different time ranges:
CREATE VIEW daily_series AS SELECT date_trunc('day', time) AS day, timevector(time, temperature) AS series FROM sensor_data GROUP BY 1;
-- Get weekly timevector from daily timevectorsSELECT date_trunc('week', day) AS week, rollup(series) AS weekly_seriesFROM daily_seriesGROUP BY 1;Arguments
Section titled “Arguments”The syntax is:
rollup( series Timevector) RETURNS Timevector| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| series | Timevector | - | ✔ | Previously constructed timevector objects to combine |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| rollup | Timevector | A timevector combining all the underlying series |