v.23.4New Feature

Support for quantileGK and quantilesGK Aggregate Functions with Greenwald-Khanna Algorithm

Support new aggregate function quantileGK/quantilesGK, like approx_percentile in spark. Greenwald-Khanna algorithm refer to http://infolab.stanford.edu/~datar/courses/cs361a/papers/quantiles.pdf. #46428 (李扬).
Introduces new aggregate functions quantileGK and quantilesGK in ClickHouse, implementing the Greenwald-Khanna algorithm for approximate quantile estimation.

Why it matters

These functions provide efficient and memory-friendly approximate quantile calculations similar to Spark's approx_percentile. They solve the problem of exact quantile computation being resource-intensive on large datasets by offering a reliable approximation with theoretical guarantees, thus improving performance and scalability.

How to use it

Use the new aggregate functions quantileGK or quantilesGK in your SELECT queries to calculate approximate quantiles. For example:

SELECT quantileGK(0.5)(column_name) FROM table_name;

These functions can be applied similarly to other aggregate functions in your queries without additional configuration.