englefly commented on code in PR #13873:
URL: https://github.com/apache/doris/pull/13873#discussion_r1011415967


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/processor/post/RuntimeFilterGenerator.java:
##########
@@ -131,6 +137,41 @@ public PhysicalPlan 
visitPhysicalHashJoin(PhysicalHashJoin<? extends Plan, ? ext
         return join;
     }
 
+    /**
+     * consider L join R on L.a=R.b
+     * runtime-filter: L.a<-R.b is effective,
+     * if R.b.selectivity<1 or b is partly covered by a
+     *
+     * TODO: min-max
+     * @param equalTo join condition
+     * @param join join node
+     * @return true if runtime-filter is effective
+     */
+    private boolean isEffectiveRuntimeFilter(EqualTo equalTo, PhysicalHashJoin 
join) {
+        StatsDeriveResult leftStats = ((AbstractPlan) 
join.child(0)).getStats();
+        StatsDeriveResult rightStats = ((AbstractPlan) 
join.child(1)).getStats();
+        Set<Slot> leftSlots = equalTo.child(0).getInputSlots();
+        if (leftSlots.size() > 1) {
+            return false;
+        }
+        Set<Slot> rightSlots = equalTo.child(1).getInputSlots();
+        if (rightSlots.size() > 1) {
+            return false;
+        }
+        Slot leftSlot = leftSlots.iterator().next();
+        Slot rightSlot = rightSlots.iterator().next();
+        ColumnStat probeColumnStat = leftStats.getColumnStatsBySlot(leftSlot);
+        ColumnStat buildColumnStat = 
rightStats.getColumnStatsBySlot(rightSlot);
+        if (probeColumnStat == null || buildColumnStat == null) {
+            probeColumnStat = leftStats.getColumnStatsBySlot(rightSlot);
+            buildColumnStat = rightStats.getColumnStatsBySlot(leftSlot);

Review Comment:
   done



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to