Skip to content

Issue found on page 'Aggregate Functions': quantile_cont(x, pos) aggregate function takes value in the range [-1, 1] for pos, needs documentation  #3306

Open
@rpbouman

Description

@rpbouman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug in the documentation. For bugs in DuckDB, please open an issue in the code repositoriesfunctionsfunctions and macrosissue found on pageneeds documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions