morrySnow commented on code in PR #13990:
URL: https://github.com/apache/doris/pull/13990#discussion_r1018815364


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java:
##########
@@ -52,6 +58,10 @@ public List<PlanPostProcessor> getProcessors() {
         Builder<PlanPostProcessor> builder = ImmutableList.builder();
         if 
(cascadesContext.getConnectContext().getSessionVariable().isEnableNereidsRuntimeFilter())
 {
             builder.add(new RuntimeFilterGenerator());
+            if 
(ConnectContext.get().getSessionVariable().enableRuntimeFilterPrune) {
+                builder.add(new RuntimeFilterPruner());
+            }
+            builder.add(new Validator());

Review Comment:
   remove this line



##########
fe/fe-core/src/main/java/org/apache/doris/planner/RuntimeFilter.java:
##########
@@ -279,7 +279,7 @@ public static RuntimeFilter 
create(IdGenerator<RuntimeFilterId> idGen, Analyzer
         if (LOG.isTraceEnabled()) {
             LOG.trace("Generating runtime filter from predicate " + 
joinPredicate);
         }
-        if 
(ConnectContext.get().getSessionVariable().enableRemoveNoConjunctsRuntimeFilterPolicy)
 {
+        if 
(ConnectContext.get().getSessionVariable().enableRuntimeFilterPrune) {

Review Comment:
   nit: use function isEnableRuntimeFilterPrune



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java:
##########
@@ -147,8 +171,28 @@ public void setTargetNullCount() {
         targetNullCount++;
     }
 
+    public void addEffectiveSrcNode(Plan node) {
+        effectiveSrcNodes.add(node);
+    }
+
+    public boolean isEffectiveSrcNode(Plan node) {
+        return effectiveSrcNodes.contains(node);
+    }
+
     @VisibleForTesting
     public int getTargetNullCount() {
         return targetNullCount;
     }
+
+    public void addJoinToTargetMap(PhysicalHashJoin join, ExprId exprId) {
+        if (joinToTargetExprId.get(join) != null) {
+            joinToTargetExprId.get(join).add(exprId);
+        } else {
+            joinToTargetExprId.put(join, Lists.newArrayList(exprId));
+        }

Review Comment:
   nit: could use computeIfAbsent



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterContext.java:
##########
@@ -91,6 +98,23 @@ public void setTargetExprIdToFilter(ExprId id, RuntimeFilter 
filter) {
         this.targetExprIdToFilter.computeIfAbsent(id, k -> 
Lists.newArrayList()).add(filter);
     }
 
+    /**
+     * remove rf from builderNode to target
+     * @param targetId rf target
+     * @param builderNode rf src

Review Comment:
   ```suggestion
        * remove rf from builderNode to target.
        *
        * @param targetId rf target
        * @param builderNode rf src
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/PlanPostProcessors.java:
##########
@@ -36,6 +37,11 @@ public PlanPostProcessors(CascadesContext cascadesContext) {
         this.cascadesContext = Objects.requireNonNull(cascadesContext, 
"cascadesContext can not be null");
     }
 
+    /**
+     * post process
+     * @param physicalPlan input plan

Review Comment:
   ```suggestion
        * post process.
        *
        * @param physicalPlan input plan
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java:
##########
@@ -1139,24 +1139,22 @@ public void setEnableNereidsStatsDeriveV2(boolean 
enableNereidsStatsDeriveV2) {
         this.enableNereidsStatsDeriveV2 = enableNereidsStatsDeriveV2;
     }
 
-    /**
-     * Serialize to thrift object.
-     * Used for rest api.
-     **/
-    public boolean isEnableRemoveNoConjunctsRuntimeFilterPolicy() {
-        return enableRemoveNoConjunctsRuntimeFilterPolicy;
+    public boolean isEnableRuntimeFilterPrune() {
+        return enableRuntimeFilterPrune;
     }
 
-    public void setEnableRemoveNoConjunctsRuntimeFilterPolicy(boolean 
enableRemoveNoConjunctsRuntimeFilterPolicy) {
-        this.enableRemoveNoConjunctsRuntimeFilterPolicy = 
enableRemoveNoConjunctsRuntimeFilterPolicy;
+    public void setEnableRuntimeFilterPrune(boolean enableRuntimeFilterPrune) {
+        this.enableRuntimeFilterPrune = enableRuntimeFilterPrune;
     }
 
     public void setFragmentTransmissionCompressionCodec(String codec) {
         this.fragmentTransmissionCompressionCodec = codec;
     }
 
-    // Serialize to thrift object
-    // used for rest api
+    /**
+     * Serialize to thrift object.
+     * Used for rest api.
+     **/

Review Comment:
   ```suggestion
        */
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterPruner.java:
##########
@@ -0,0 +1,195 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.processor.post;
+
+import org.apache.doris.nereids.CascadesContext;
+import org.apache.doris.nereids.trees.expressions.EqualTo;
+import org.apache.doris.nereids.trees.expressions.ExprId;
+import org.apache.doris.nereids.trees.expressions.Expression;
+import org.apache.doris.nereids.trees.expressions.Slot;
+import org.apache.doris.nereids.trees.plans.AbstractPlan;
+import org.apache.doris.nereids.trees.plans.Plan;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalAggregate;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalAssertNumRows;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalDistribute;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalFilter;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalHashJoin;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalLimit;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalLocalQuickSort;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalOlapScan;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalProject;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalQuickSort;
+import org.apache.doris.nereids.trees.plans.physical.PhysicalTopN;
+import org.apache.doris.statistics.ColumnStat;
+import org.apache.doris.statistics.StatsDeriveResult;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * prune rf
+ */

Review Comment:
   plz add some comment to explain what is EffectiveSrcNode and how this class 
work



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to