QUANTILE_CONT() OVER ...
All functions > WINDOW FUNCTION > QUANTILE_CONT() OVER ...
Returns the continuous quantile of the window at the given probability; result type is DOUBLE.
Syntax
QUANTILE_CONT(expr, quantile) OVER ([PARTITION BY expr [, ...]] [ORDER BY sort_item [, ...]] [ROWS|RANGE|GROUPS frame])
Notes
- SQL translation is implemented only when the current SQL backend is DuckDB
- Requires a well-defined window (ORDER BY, and optionally PARTITION BY and frame)
- NULL values are ignored where the underlying window aggregate skips NULLs
- Use a DOUBLE value expression (for example 10e0) so translation matches the DOUBLE quantile argument
See also
Examples
FeatureQL
SELECT
f1 := ZIP(ARRAY[1,2,3] AS id, ARRAY[10e0, 20e0, 30e0] AS v).TRANSFORM(SELECT QUANTILE_CONT(v, 0.5e0) OVER (ORDER BY id ASC)).UNWRAP() -- Running continuous 0.5 quantile
;Result
| f1 ARRAY |
|---|
| [10.0, 15.0, 20.0] |