Introduced in: v24.1.0
Computes an approximate quantile of a sample with relative-error guarantees. It works by building a DD.
Syntax
quantileDD(relative_accuracy, [level])(expr)Arguments
expr— Expression over the column values resulting in numeric data types,DateorDateTime.(U)Int*orFloat*orDateorDateTime
Returned value
Approximate quantile of the specified level. For Date and DateTime inputs the output format matches the input format. Float64 or Date or DateTime
Examples
Computing quantile with DD sketch
CREATE TABLE example_table (a UInt32, b Float32) ENGINE = Memory;
INSERT INTO example_table VALUES (1, 1.001), (2, 1.002), (3, 1.003), (4, 1.004);
SELECT quantileDD(0.01, 0.75)(a), quantileDD(0.01, 0.75)(b) FROM example_table;┌─quantileDD(0.01, 0.75)(a)─┬─quantileDD(0.01, 0.75)(b)─┐
│ 2.9742334234767016 │ 1.01 │
└───────────────────────────┴───────────────────────────┘