feiniaofeiafei commented on code in PR #69344:
URL: https://github.com/apache/doris/pull/69344#discussion_r4549829843
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/PushDownFilterThroughSetOperation.java:
##########
@@ -76,30 +77,21 @@ public Rule build() {
// "half of A intersect half of B" instead of "half of (A
intersect B)").
boolean canPushVolatileExpr = setOperation instanceof
LogicalUnion
&& setOperation.getQualifier() == Qualifier.ALL;
- Set<Expression> pushableConjuncts;
- Set<Expression> keptAboveConjuncts;
- boolean allConjunctsPushable;
- if (canPushVolatileExpr) {
- pushableConjuncts = origFilter.getConjuncts();
- keptAboveConjuncts = ImmutableSet.of();
- allConjunctsPushable = true;
- } else {
- pushableConjuncts = new LinkedHashSet<>();
- Set<Expression> kept = new LinkedHashSet<>();
- for (Expression c : origFilter.getConjuncts()) {
- if (c.containsVolatileOrNoneMovableExpression()) {
- kept.add(c);
- } else {
- pushableConjuncts.add(c);
- }
- }
- keptAboveConjuncts = kept;
- if (pushableConjuncts.isEmpty()) {
- return null;
+ Set<Expression> pushableConjuncts = new LinkedHashSet<>();
+ Set<Expression> keptAboveConjuncts = new LinkedHashSet<>();
+ for (Expression conjunct : origFilter.getConjuncts()) {
+ // Equal values in different branches may use different
indexes or analyzers.
+ if (conjunct.containsType(SourceDependentExpression.class)
Review Comment:
Thanks for pointing this out. I agree that pushing MATCH into both UNION ALL
branches is safe in this example because both branches read the same indexed
column. This PR keeps the conservative behavior, so the outer MATCH in your
example will be rejected. I'll defer support for same-source MATCH pushdown
through UNION ALL to a follow-up, where we can verify the column source in
every branch and add a positive regression 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]