[fix](Nereids): when predicate contains right output, don't convert outer to anti join (#30276)
This commit is contained in:
@ -81,7 +81,8 @@ public class ConvertOuterJoinToAntiJoin extends OneRewriteRuleFactory {
|
||||
&& rightAlwaysNullSlots.containsAll(p.getInputSlots())))
|
||||
.collect(ImmutableSet.toImmutableSet());
|
||||
boolean containRightSlot = predicates.stream()
|
||||
.anyMatch(s -> join.right().getOutputSet().containsAll(s.getInputSlots()));
|
||||
.flatMap(p -> p.getInputSlots().stream())
|
||||
.anyMatch(join.right().getOutputSet()::contains);
|
||||
if (!containRightSlot) {
|
||||
res = join.withJoinType(JoinType.LEFT_ANTI_JOIN);
|
||||
res = predicates.isEmpty() ? res : filter.withConjuncts(predicates).withChildren(res);
|
||||
@ -94,7 +95,8 @@ public class ConvertOuterJoinToAntiJoin extends OneRewriteRuleFactory {
|
||||
&& leftAlwaysNullSlots.containsAll(p.getInputSlots())))
|
||||
.collect(ImmutableSet.toImmutableSet());
|
||||
boolean containLeftSlot = predicates.stream()
|
||||
.anyMatch(s -> join.left().getOutputSet().containsAll(s.getInputSlots()));
|
||||
.flatMap(p -> p.getInputSlots().stream())
|
||||
.anyMatch(join.left().getOutputSet()::contains);
|
||||
if (!containLeftSlot) {
|
||||
res = join.withJoinType(JoinType.RIGHT_ANTI_JOIN);
|
||||
res = predicates.isEmpty() ? res : filter.withConjuncts(predicates).withChildren(res);
|
||||
|
||||
Reference in New Issue
Block a user