quantile
The exact quantile at option q (0 to 1): method cont (default) interpolates linearly at (n - 1)q (a decimal exactly, rounded half to even), disc takes the first value whose cumulative share reaches q (position ceil(nq) - 1).
Flags
| Flag | Value |
|---|---|
| Kind | aggregate |
| Nulls | nulls are skipped |
| Deterministic | yes |
| Order matters | no |
| Decomposable | yes, by the values, sorted |
Example
A pipeline from the language's tested corpus that uses quantile, over the example tables.
from orders
aggregate {med = median(amount), p90 = quantile(amount, q: 9e-1), p10 = quantile(price, q: 1e-1, method: "disc"), v = var_samp(price), sd = stddev_samp(price), m = mode(status), d = count_distinct(customer)} by:{rush}In a plan:
{
"args": [
{
"col": 2
}
],
"fn": "quantile",
"options": {
"q": 0.9
}
}