**Use case**
Clickhouse version 21.4
```
SELECT
    quantileTiming(0.95)(key) AS timing,
    quantileExact(0.95)(key) AS exact,
    quantileTDigest(0.95)(key) AS tdigest
FROM
(
    SELECT
        9000 AS key,
        2 AS count
    UNION ALL
    SELECT
        3000,
        11
    UNION ALL
    SELECT
        1000,
        26
)
ARRAY JOIN range(count) AS s

Query id: addce63f-0b75-46e2-b896-712d66711fb0

┌─timing─┬─exact─┬──tdigest─┐
│   9000 │  9000 │ 8123.076 │
└────────┴───────┴──────────┘


SELECT
    quantileTiming(0.9)(key) AS timing,
    quantileExact(0.9)(key) AS exact,
    quantileTDigest(0.9)(key) AS tdigest
FROM
(
    SELECT key
    FROM
    (
        SELECT
            9000 AS key,
            2 AS count
        UNION ALL
        SELECT
            3000,
            11
        UNION ALL
        SELECT
            1000,
            26
    )
    ARRAY JOIN range(count) AS s
    ORDER BY key ASC
)

Query id: e92e3d07-3b97-4155-aa10-9a15544d9312

┌─timing─┬─exact─┬───tdigest─┐
│   3000 │  3000 │ 6323.0757 │
└────────┴───────┴───────────┘

```

Probably related: https://github.com/tdunning/t-digest/issues/154
};
    /** max_centroids_deserialize should be >= all max_centroids ever used in production.
     *  This is security parameter, preventing allocation of too much centroids in deserialize, so can be relatively large.
     */
    static constexpr size_t max_centroids_deserialize = 65536;
    static constexpr Params params{};
    static constexpr size_t bytes_in_arena = 128 - sizeof(PODArray<Centroid>) - sizeof(BetterFloat) - sizeof(size_t); 
    using Centroids = PODArrayWithStackMemory<Centroid, bytes_in_arena>;
    Centroids centroids;
    BetterFloat count = 0;
    size_t unmerged = 0;
    /** Linear interpolation at the point x on the line (x1, y1)..(x2, y2)
      */
    static Value interpolate(Value x, Value x1, Value y1, Value x2, Value y2)
    {
        double k = (x - x1) / (x2 - x1);
        return y1 + k * (y2 - y1);
    }
    struct RadixSortTraits
    {
        using Element = Centroid;
        using Result = Element;
        using Key = Value;
        using CountType = UInt32;
        using KeyBits = UInt32;
        static constexpr size_t PART_SIZE_BITS = 8;
        using Transform = RadixSortFloatTransform<KeyBits>;
        using Allocator = RadixSortAllocator;
        
        static Key & extractKey(Element & elem) { return elem.mean; }