quantilesExactWeighted
Exactly computes multiple [quantiles](https://en.
This page describes the RawTree engine binary used to generate this reference. It does not define Query API support. Descriptions retain upstream ClickHouse terminology. See SQL interface scope.
Exactly computes multiple quantiles of a numeric data sequence at different levels simultaneously, taking into account the weight of each element.
This function is equivalent to quantileExactWeighted but allows computing multiple quantile levels in a single pass, which is more efficient than calling individual quantile functions.
Syntax
quantilesExactWeighted(level1, level2, ...)(expr, weight)Parameters
level— Levels of quantiles. One or more constant floating-point numbers from 0 to 1. We recommend usinglevelvalues in the range of[0.01, 0.99].Float*
Arguments
expr— Expression over the column values resulting in numeric data types,Date,DateTimeorDateTime64.(U)Int*orInt128orUInt128orInt256orUInt256orFloat*orDecimal*orDateorDateTimeorDateTime64weight— Column with weights of sequence members. Weight is a number of value occurrences.UInt*
Returned value
Array of quantiles of the specified levels in the same order as the levels were specified. For numeric data types the output format matches the input format. Array((U)Int*) or Array(Int128) or Array(UInt128) or Array(Int256) or Array(UInt256) or Array(Float*) or Array(Decimal*) or Array(Date) or Array(DateTime) or Array(DateTime64)
Examples
Computing multiple exact weighted quantiles
SELECT quantilesExactWeighted(0.25, 0.5, 0.75)(number, 1) FROM numbers(10)┌─quantilesExactWeighted(0.25, 0.5, 0.75)(number, 1)─┐
│ [2,4,7] │
└────────────────────────────────────────────────────┘Introduced in version 1.1.0.