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


##########
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:
   [P2] Preserve MATCH pushdown through same-source UNION ALL
   
   `Match` now implements `SourceDependentExpression`, so this guard also 
strands previously supported MATCH predicates above UNION ALL. For example, 
with an inverted index on `t.title`:
   
   ```sql
   SELECT label FROM (
     SELECT title AS label FROM t WHERE id = 1
     UNION ALL
     SELECT title FROM t WHERE id = 2
   ) s WHERE label MATCH 'hello';
   ```
   
   The reduced tree is `Filter(Match(label)) -> UnionAll(Project(title AS 
label) -> Scan(t), Project(title) -> Scan(t))`. Previously, 
`addFiltersToNewChildren` and project substitution moved MATCH to both scans. 
Now the rule retains it above the union, and 
`CheckAfterRewrite.checkMatchIsUsedCorrectly` throws `only support in olapScan 
filter`. Both branches use the same physical column/index/analyzer, so the 
previous pushdown preserves source semantics. Preserve this safe existing case 
and add a positive MATCH-over-UNION-ALL regression. This is distinct from the 
earlier outer-SEARCH/EXCEPT finding, which involved different analyzers and 
incorrect subtraction.



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