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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ProjectOtherJoinConditionForNestedLoopJoin.java:
##########
@@ -114,6 +114,13 @@ public Expression visit(Expression expression, 
ReplacerContext ctx) {
             if (input.isEmpty() || expression instanceof Slot) {
                 return expression;
             }
+            // A mixed expression like `t1.a + rand() > t2.b` has 
inputSlots={t1.a}; if we alias
+            // it into a child Project, rand()'s evaluation granularity 
changes from "per join
+            // pair" to "per row of that child", which silently changes 
results. Keep such
+            // expressions inline in otherJoinConjuncts.
+            if (expression.containsUniqueFunction()) {

Review Comment:
   Replied in the main PR comment: this is a pre-existing trade-off in 
`AddProjectForUniqueFunction.JoinRewrite` caused by `BETWEEN` expansion into 
two independent `rand()` calls, and is intentionally out of scope for this PR. 
Please see the main comment for the full reasoning.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/ProjectOtherJoinConditionForNestedLoopJoin.java:
##########
@@ -114,6 +114,13 @@ public Expression visit(Expression expression, 
ReplacerContext ctx) {
             if (input.isEmpty() || expression instanceof Slot) {
                 return expression;
             }
+            // A mixed expression like `t1.a + rand() > t2.b` has 
inputSlots={t1.a}; if we alias
+            // it into a child Project, rand()'s evaluation granularity 
changes from "per join
+            // pair" to "per row of that child", which silently changes 
results. Keep such
+            // expressions inline in otherJoinConjuncts.
+            if (expression.containsUniqueFunction()) {

Review Comment:
   Replied in the main PR comment: this is a pre-existing trade-off in 
`AddProjectForUniqueFunction.JoinRewrite` caused by `BETWEEN` expansion into 
two independent `rand()` calls, and is intentionally out of scope for this PR. 
Please see the main comment for the full reasoning.



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