Open
Description
The docs for aggregate function quantile_cont(x, pos) read:
The interpolated pos-quantile of x for 0 <= pos <= 1,
But when we enter an out of range value, the error message tells us the range for pos
is [-1, 1]
:
select quantile_cont(x, 2)
from range(0,100) as T(x)
output:
Binder Error: QUANTILE can only take parameters in the range [-1, 1]
When I try to use negative values within the range, it appears as if negative values are interpreted to "counting backwards", as if for for 0 < y <=1,
quantile_cont(x, -y)
is equivalent to
quantile_cont(x, 1-y)
For example:
SELECT quantile_cont(x, -0.1) as "q-0.1"
, quantile_cont(x, 1 - 0.1) as "q1-0.1"
, "q-0.1" = "q1-0.1" as "eq"
from range(0, 100) as T(x)
output:
┌───────────────────┬───────────────────┬─────────┐
│ q-0.1 │ q1-0.1 │ eq │
│ double │ double │ boolean │
├───────────────────┼───────────────────┼─────────┤
│ 89.10000000000001 │ 89.10000000000001 │ true │
└───────────────────┴───────────────────┴─────────┘
Page URL: https://duckdb.org/docs/sql/functions/aggregates.html