first_val()
Get the first value from a TimeWeightSummary aggregate
Since 1.11.0
Get the value of the first point in a TimeWeightSummary aggregate.
Samples
Section titled “Samples”Produce a linear TimeWeightSummary over the column val and get the first value:
WITH t as ( SELECT time_bucket('1 day'::interval, ts) as dt, time_weight('Linear', ts, val) AS tw FROM table GROUP BY time_bucket('1 day'::interval, ts))SELECT dt, first_val(tw)FROM t;Arguments
Section titled “Arguments”The syntax is:
first_val( tw TimeWeightSummary) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| tws | TimeWeightSummary | - | ✔ | The input TimeWeightSummary from a time_weight() call |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| first_val | DOUBLE PRECISION | The value of the first point in the TimeWeightSummary |