yujun777 commented on code in PR #62742:
URL: https://github.com/apache/doris/pull/62742#discussion_r3332794834


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughJoin.java:
##########
@@ -120,11 +120,14 @@ public Rule build() {
             Set<Expression> rightPredicates = Sets.newLinkedHashSet();
             Set<Expression> remainingPredicates = Sets.newLinkedHashSet();
             for (Expression p : filterPredicates) {
-                if (p.containsUniqueFunction()) {
+                Set<Slot> slots = p.collect(SlotReference.class::isInstance);
+                if (p.containsUniqueFunction() && slots.isEmpty()) {

Review Comment:
   This is addressed after the rebase to current upstream/master. 
`PushDownFilterThroughJoin` now checks `p.containsVolatileExpression()` before 
slot-based pushdown, so both empty-slot predicates like `rand() > 0.1` and 
one-sided predicates like `t2.id + rand() > 0.2` are kept in 
`remainingPredicates` above the join. I also updated the regression case 
comment to reflect that volatile predicates should stay above the join even 
when they reference only one side.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughJoin.java:
##########
@@ -120,11 +120,14 @@ public Rule build() {
             Set<Expression> rightPredicates = Sets.newLinkedHashSet();
             Set<Expression> remainingPredicates = Sets.newLinkedHashSet();
             for (Expression p : filterPredicates) {
-                if (p.containsUniqueFunction()) {
+                Set<Slot> slots = p.collect(SlotReference.class::isInstance);
+                if (p.containsUniqueFunction() && slots.isEmpty()) {

Review Comment:
   This has been fixed by the current rebased code as well. The old narrowed 
guard no longer exists on this branch: `PushDownFilterThroughJoin` first routes 
any `containsVolatileExpression()` predicate to `remainingPredicates`, before 
checking input slots. Therefore a one-sided volatile predicate such as `WHERE 
t2.id + rand() > 0.2` is not pushed into the right child and remains evaluated 
per joined row. I updated the test comment accordingly.



-- 
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