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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/OrExpansion.java:
##########
@@ -160,19 +162,23 @@ public Plan visitLogicalJoin(LogicalJoin<? extends Plan, 
? extends Plan> join, O
             joins.addAll(expandInnerJoin(ctx.cascadesContext, 
hashOtherConditions,
                     join, leftProducer, rightProducer, leftCloneToLeft, 
rightCloneToRight));
         } else if (join.getJoinType().isOuterJoin()) {
-            // left outer join = inner join union left anti join
+            // Outer join = matching rows union unmatched rows from each 
preserved side.
             joins.addAll(expandInnerJoin(ctx.cascadesContext, 
hashOtherConditions,
                     join, leftProducer, rightProducer, leftCloneToLeft, 
rightCloneToRight));
-            joins.add(expandLeftAntiJoin(ctx.cascadesContext,
-                    hashOtherConditions, join, leftProducer, rightProducer, 
leftCloneToLeft, rightCloneToRight));
-            if (join.getJoinType().equals(JoinType.FULL_OUTER_JOIN)) {
-                // full outer join = inner join union left anti join union 
right anti join
+            if (join.getJoinType().isLeftOuterJoin() || 
join.getJoinType().isFullOuterJoin()) {
+                joins.add(expandLeftAntiJoin(ctx.cascadesContext,
+                        hashOtherConditions, join, leftProducer, 
rightProducer, leftCloneToLeft, rightCloneToRight));

Review Comment:
   Fixed in 1aa2cd10d3a. The shared OR expansion eligibility check now skips 
joins whose ON conjuncts contain a volatile expression or a 
`NoneMovableFunction`. This also covers existing left joins and right joins 
that normalize to left joins.
   
   Added unit coverage for `rand()` and `assert_true()` across all six 
supported join types, plus EXPLAIN coverage for left and right outer joins. All 
20 `OrExpansionTest` cases passed locally.
   



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