v.21.6Improvement

Fixed quantile(s)TDigest: Enhanced singleton handling and resolved centroid over-compression bug

Fixed quantile(s)TDigest. Added special handling of singleton centroids according to tdunning/t-digest 3.2+. Also a bug with over-compression of centroids in implementation of earlier version of the algorithm was fixed. #23314 (Vladimir Chebotarev).
Fixed the quantile(s)TDigest aggregate function to correctly handle singleton centroids according to t-digest 3.2+ specifications and resolved a bug causing over-compression of centroids in earlier algorithm versions.

Why it matters

This fix ensures accurate quantile estimations by aligning the implementation with the updated t-digest 3.2+ algorithm, preventing errors caused by improper centroid compression and handling of singleton centroids. It improves reliability and precision of approximate quantile calculations in ClickHouse.

How to use it

Users can benefit from this fix by using the quantile(s)TDigest aggregate functions as usual in their SELECT queries. No additional configuration is required as the correction is applied internally in the function implementation.