github-actions[bot] commented on code in PR #65802:
URL: https://github.com/apache/doris/pull/65802#discussion_r3627271418
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/hint/LeadingHint.java:
##########
@@ -416,14 +416,18 @@ public Pair<JoinConstraint, Boolean>
getJoinConstraint(Long joinTableBitmap, Lon
continue;
}
- if (joinConstraint.getJoinType().isSemiJoin()) {
- if (LongBitmap.isSubset(joinConstraint.getRightHand(),
leftTableBitmap)
- && !LongBitmap.isSubset(joinConstraint.getRightHand(),
leftTableBitmap)) {
+ if (joinConstraint.getJoinType().isSemiOrAntiJoin()) {
+ if (!LongBitmap.isSubset(joinConstraint.getMinLeftHand(),
joinTableBitmap)
+ ||
!LongBitmap.isSubset(joinConstraint.getMinRightHand(), joinTableBitmap)) {
continue;
}
- if (LongBitmap.isSubset(joinConstraint.getRightHand(),
rightTableBitmap)
- &&
!joinConstraint.getRightHand().equals(rightTableBitmap)) {
- continue;
+ Long constrainedSide =
joinConstraint.getJoinType().isRightSemiOrAntiJoin()
+ ? joinConstraint.getLeftHand() :
joinConstraint.getRightHand();
+ if ((LongBitmap.isSubset(constrainedSide, leftTableBitmap)
Review Comment:
[P1] Reject composite constrained sides split across both children
These `isSubset` checks only catch a constrained side wholly contained in
one oversized child. They miss a composite side split between both children.
For example, start from:
```text
LeftSemi[Pab]
A
LeftSemi[Pbc]
B
C
```
Collection records inner constraint `JC1=(B,C)` and outer `JC2=(A,B|C)`.
With `leading(B A C)`, the final children are `B|A` and `C`: JC1 matches, while
JC2's full constrained side `B|C` is a subset of neither child, so this guard
misses it and the later overlap branch leaves JC1 selected. Both predicates are
semi-compatible, producing `LeftSemi[Pab,Pbc](Cross(B,A),C)`. That retains one
A row per matching B, whereas the original outer semi retains each A once (two
matching B rows already make the results differ). Nested anti joins fail
analogously.
Once both minimum hands are present, please reject any constrained-side
overlap unless that child equals the full side (for example, `isOverlap(...) &&
!equals(...)`), and add a nested/composite constraint test. This is distinct
from the earlier singleton-side-plus-extra-table thread.
--
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]