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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownJoinOtherCondition.java:
##########
@@ -75,7 +75,16 @@ public Rule build() {
                     Set<Expression> rightConjuncts = Sets.newHashSet();
 
                     for (Expression otherConjunct : otherJoinConjuncts) {
-                        if 
(PUSH_DOWN_LEFT_VALID_TYPE.contains(join.getJoinType())
+                        // Keep slot-free volatile predicates in 
otherJoinConjuncts. Otherwise
+                        // `allCoveredBy(..., child.getOutputSet())` would 
arbitrarily push
+                        // `rand() > 0.5` into one side because empty slots 
are covered by both
+                        // children. Side-specific volatile predicates are 
still pushed down for
+                        // performance, matching PostgreSQL's treatment of 
single-relation INNER
+                        // JOIN ON quals as base restrictions.
+                        if (otherConjunct.containsVolatileExpression()

Review Comment:
   Thanks, addressed in 0e523879874. PushDownJoinOtherCondition now keeps every 
containsVolatileExpression() ON conjunct in otherJoinConjuncts, including 
one-sided predicates such as t1.id + rand() > 0.5, so the join-pair evaluation 
granularity is preserved. For BETWEEN-expanded repeated volatile expressions, 
AddProjectForVolatileExpression materializes one value later: right-only 
expressions are projected on the right child, otherwise it falls back to the 
left child, and volatile expressions whose own slots span both join children 
are skipped because join has no pair-scope project. I also added FE unit tests 
and explain-shape regression cases for the one-sided volatile ON predicate and 
left/right/slot-free BETWEEN cases.



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