diff --git a/src/query/src/tdigest.c b/src/query/src/tdigest.c index 109fd7574f04a7f82e92f112551ca9494c7e667a..4870d1ff60d2cd7db69a01587d5e48515bdf67d7 100644 --- a/src/query/src/tdigest.c +++ b/src/query/src/tdigest.c @@ -296,7 +296,7 @@ double tdigestQuantile(TDigest *t, double q) { a = b; right = t->max; - if (idx < weight_so_far + a->weight) { + if (idx < weight_so_far + a->weight && a->weight != 0) { double p = (idx - weight_so_far) / a->weight; return left * (1 - p) + right * p; }