rollup(cs CounterSummary) RETURNS CounterSummary
An aggregate to compute a combined
CounterSummary from a series of
For more information about counter aggregation functions, see the hyperfunctions documentation.
|CounterSummary||The input CounterSummary from a previous |
|CounterSummary||A CounterSummary object that can be passed to accessor functions or other objects in the counter aggregate API|
WITH t as (SELECTdate_trunc('day', ts) as dt,counter_agg(ts, val) AS counter_summary -- get a time weight summaryFROM fooWHERE id = 'bar'GROUP BY date_trunc('day')), q as (SELECT rollup(counter_summary) AS full_cs -- do a second level of aggregation to get the full CounterSummaryFROM t)SELECTdt,delta(counter_summary), -- extract the delta from the CounterSummarydelta(counter_summary) / (SELECT delta(full_cs) FROM q LIMIT 1) as normalized -- get the fraction of the delta that happened each day compared to the full change of the counterFROM t;
Found an issue on this page?Report an issue!