xzj7019 commented on code in PR #41731:
URL: https://github.com/apache/doris/pull/41731#discussion_r1797582360
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PullUpPredicates.java:
##########
@@ -153,14 +214,35 @@ public ImmutableSet<Expression>
visitLogicalFilter(LogicalFilter<? extends Plan>
@Override
public ImmutableSet<Expression> visitLogicalJoin(LogicalJoin<? extends
Plan, ? extends Plan> join, Void context) {
return cacheOrElse(join, () -> {
- Set<Expression> predicates = Sets.newHashSet();
- ImmutableSet<Expression> leftPredicates = join.left().accept(this,
context);
- ImmutableSet<Expression> rightPredicates =
join.right().accept(this, context);
- predicates.addAll(leftPredicates);
- predicates.addAll(rightPredicates);
- if (join.getJoinType() == JoinType.CROSS_JOIN ||
join.getJoinType() == JoinType.INNER_JOIN) {
- predicates.addAll(join.getHashJoinConjuncts());
- predicates.addAll(join.getOtherJoinConjuncts());
+ Set<Expression> predicates = new LinkedHashSet<>();
+ Supplier<ImmutableSet<Expression>> leftPredicates =
Suppliers.memoize(
+ () -> join.left().accept(this, context));
+ Supplier<ImmutableSet<Expression>> rightPredicates =
Suppliers.memoize(
+ () -> join.right().accept(this, context));
+ switch (join.getJoinType()) {
+ case CROSS_JOIN:
+ case INNER_JOIN: {
+ predicates.addAll(leftPredicates.get());
+ predicates.addAll(rightPredicates.get());
+ predicates.addAll(join.getHashJoinConjuncts());
+ predicates.addAll(join.getOtherJoinConjuncts());
+ break;
+ }
+ case LEFT_OUTER_JOIN:
+ case LEFT_SEMI_JOIN:
+ case LEFT_ANTI_JOIN:
Review Comment:
why anti join's predicate can be pulled up?
--
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]