github-actions[bot] commented on code in PR #66182:
URL: https://github.com/apache/doris/pull/66182#discussion_r3701903024


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java:
##########
@@ -335,6 +336,7 @@ public class Rewriter extends AbstractBatchJobExecutor {
                                     ),
                                     // push down SEMI Join
                                     bottomUp(
+                                            new SemiJoinCommute(),

Review Comment:
   [P1] Preserve the full RIGHT SEMI constraint before commuting here
   
   Running `SemiJoinCommute` only in rewrite is too late for 
`CollectJoinConstraint`. A reduced analyzed tree is:
   
   ```text
   Project(B.k)
     RightSemiJoin(A.k = B.k)
       Inner/CrossJoin(A, C)
       B
   ```
   
   This now records `minLeft={A}`, `minRight={B}` and an `{A,B}` filter. 
`LEADING(B A C)` can therefore consume the equality while building 
`LeftSemiJoin(B,A)`, then append C as a cross join. With one matching A/B row 
and two C rows, the original right semi join returns B once, while the 
generated tree returns B twice. Late commute cannot repair it because generated 
joins are marked leading.
   
   This is distinct from the existing RIGHT OUTER predicate-pushdown thread: it 
uses a two-sided equality and loses the multi-table semi-join boundary. Please 
canonicalize RIGHT join constraint metadata to the semantic LEFT form (or make 
`minLeftHand`/`minRightHand` collection symmetric) before `LeadingJoin`, and 
add a three-table RIGHT SEMI result/shape test.



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