From a576328740137905bd7a31d400b453d20a88c140 Mon Sep 17 00:00:00 2001 From: Mohit Saxena Date: Thu, 21 Oct 2021 22:02:25 +0530 Subject: [PATCH] Adding condition to check for Zero values --- src/query/src/tdigest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/query/src/tdigest.c b/src/query/src/tdigest.c index 109fd7574f..4870d1ff60 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; } -- GitLab