From e9b64c4f793e069b5754eae1e7d9d3ed00201c73 Mon Sep 17 00:00:00 2001 From: "zhongjian.xzj" Date: Wed, 11 Sep 2024 21:24:38 +0800 Subject: [PATCH] [opt](nereids) refine expression estimation --- .../java/org/apache/doris/nereids/stats/FilterEstimation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java index a65a07fea30bdfc..a03c8d1ce7e9e9b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/stats/FilterEstimation.java @@ -332,7 +332,8 @@ private Statistics estimateEqualTo(ComparisonPredicate cp, ColumnStatistic stats } else { double val = statsForRight.maxValue; if (val > statsForLeft.maxValue || val < statsForLeft.minValue) { - selectivity = 0.0; + // do a lower bound protection to avoid using 0 directly + selectivity = RANGE_SELECTIVITY_THRESHOLD; } else if (ndv >= 1.0) { selectivity = StatsMathUtil.minNonNaN(1.0, 1.0 / ndv); } else {