quantileExactInclusive
Introduced in: v20.1.0 Similar toquantileExact, this computes the exact quantile of a numeric data sequence.
This function is equivalent to quantileExact but uses the inclusive method for calculating quantiles, as described in the R-7 method.
When using this function, the quantile is calculated such that the interpolation formula for a given quantile p takes the form: x[floor((n-1)*p)] + ((n-1)*p - floor((n-1)*p)) * (x[floor((n-1)*p)+1] - x[floor((n-1)*p)]), where x is the sorted array.
To get the exact value, all the passed values are combined into an array, which is then fully sorted.
The sorting algorithm’s complexity is O(N·log(N)), where N = std::distance(first, last) comparisons.
When using multiple quantile* functions with different levels in a query, the internal states are not combined (that is, the query works less efficiently than it could).
In this case, use the quantiles function.
Syntax
level— Level of quantile. Constant floating-point number from 0 to 1 (inclusive). We recommend using alevelvalue in the range of[0.01, 0.99].Float*
expr— Expression over the column values resulting in numeric data types, Date or DateTime.(U)Int*orFloat*orDecimal*orDateorDateTime
Float64
Examples
Computing exact inclusive quantile
Query
Response
Query
Response