You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2023/04/12 09:55:38 UTC

[doris] branch master updated: [enhancement](Nereids) Simplify the codes for runtime filter validation (#18571)

This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 09a4e9fd6b [enhancement](Nereids) Simplify the codes for runtime filter validation (#18571)
09a4e9fd6b is described below

commit 09a4e9fd6bdb9a0672a62a749404179113db81e0
Author: AKIRA <33...@users.noreply.github.com>
AuthorDate: Wed Apr 12 18:55:29 2023 +0900

    [enhancement](Nereids) Simplify the codes for runtime filter validation (#18571)
    
    Since the goal of `ColumnStatistic#coverage` function is to determine whether the build side range is complete enclosed by the range of probe side, if so, as the comment of `RuntimeFilterPruner` explained, corresponding runtime filter might be thought as useless and get pruned.
    
    Howerver, the original logic of this method is quite confused.
    
    Simplify its logic by this formula:
    
    ```java
    !(this.maxValue >= other.maxValue && this.maxValue <= other.maxValue)
    ```
---
 .../processor/post/RuntimeFilterPruner.java        |  2 +-
 .../apache/doris/statistics/ColumnStatistic.java   | 25 ++++++----------------
 2 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
index 62ec9a1a3d..6534bc715e 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java
@@ -200,7 +200,7 @@ public class RuntimeFilterPruner extends PlanPostProcessor {
             return true;
         }
         return buildColumnStat.selectivity < 1
-                || probeColumnStat.coverage(buildColumnStat) < 1
+                || probeColumnStat.notEnclosed(buildColumnStat)
                 || buildColumnStat.ndv < probeColumnStat.ndv * 0.95;
     }
 }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
index 5b58f5644a..2e2cb9b66c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/statistics/ColumnStatistic.java
@@ -251,26 +251,15 @@ public class ColumnStatistic {
         }
     }
 
+    public boolean notEnclosed(ColumnStatistic other) {
+        return !enclosed(other);
+    }
+
     /**
-     * the percentage of intersection range to this range
-     * @param other
-     * @return
+     * Return true if range of this is enclosed by another.
      */
-    public double coverage(ColumnStatistic other) {
-        if (isUnKnown) {
-            return 1.0;
-        }
-        if (minValue == maxValue) {
-            if (other.minValue <= minValue && minValue <= other.maxValue) {
-                return 1.0;
-            } else {
-                return 0.0;
-            }
-        } else {
-            double myRange = maxValue - minValue;
-            double interSection = Math.min(maxValue, other.maxValue) - Math.max(minValue, other.minValue);
-            return interSection / myRange;
-        }
+    public boolean enclosed(ColumnStatistic other) {
+        return this.maxValue >= other.maxValue && this.maxValue <= other.maxValue;
     }
 
     @Override


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org