QUANTILE_CONT() GROUP BY ...
All functions > GROUP BY > QUANTILE_CONT() GROUP BY ...
Returns the continuous quantile of the group at the given probability in (0, 1); result type is DOUBLE.
Syntax
QUANTILE_CONT(expr, quantile) [ FILTER (WHERE condition) ] [ GROUP BY feature [, feature ...] ]
Notes
- NULL values are ignored where the underlying aggregate skips NULLs
- Can be used with FILTER (WHERE condition) and GROUP BY like other aggregates
- quantile uses DOUBLE (for example 0.5e0 for the median along the continuous definition)
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[1, 1, 1] AS g, ARRAY[1e0, 2e0, 3e0] AS x).TRANSFORM(SELECT QUANTILE_CONT(x, 0.5e0) GROUP BY g).UNWRAP_ONE() -- Continuous 0.5 quantile over one group
;Result
| f1 VARCHAR |
|---|
| 2.0 |