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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/hint/LeadingHint.java:
##########
@@ -474,6 +509,12 @@ public Pair<JoinConstraint, Boolean> 
getJoinConstraint(Long joinTableBitmap, Lon
                     return Pair.of(null, false);
                 }
 
+                // The preserved side (minLeftHand) is not yet in the join —
+                // this constraint is not applicable, skip it.
+                if (!LongBitmap.isSubset(joinConstraint.getMinLeftHand(), 
joinTableBitmap)) {
+                    continue;

Review Comment:
   This skip still lets the nullable side of a pending one-sided outer join 
absorb unrelated inputs before the preserved side arrives. For example:
   
   ```text
   CrossJoin
     LeftOuterJoin ON a.k = b.k
       a
       b
     c
   ```
   
   With `leading(b c a)`, the `{b,c}` join reaches this branch because 
`minLeftHand={a}` is absent, so it is built as a CROSS join. At the final join, 
`{b,c}` vs `{a}` matches the original left outer constraint in reversed form, 
consumes `a.k = b.k`, leaves no filters, and the hint can succeed as `(b CROSS 
JOIN c) RIGHT OUTER JOIN a`.
   
   That is not equivalent: for unmatched `a` rows the original plan still cross 
joins every real `c` row (and returns none if `c` is empty), but the rewritten 
right outer join emits a single null-extended row with `c` NULL. Please either 
block a pending outer join's nullable side from mixing with unrelated tables 
before the preserved side arrives, or require the nullable-side child to remain 
exactly the original nullable side when the outer constraint is matched, and 
cover both left-outer and right-outer CROSS variants through the real 
leading-hint plan path.



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