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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/RewriteSearchToSlots.java:
##########
@@ -55,17 +53,19 @@ public class RewriteSearchToSlots extends 
OneRewriteRuleFactory {
 
     @Override
     public Rule build() {
-        return logicalFilter(logicalOlapScan())
+        return logicalFilter()

Review Comment:
   [P1] Preserve EXCEPT subtraction when pushing down outer SEARCH
   
   The generalized binding now admits this reduced plan:
   
   ```text
   Filter(SEARCH(label:hello))
     Except
       Project(title AS label) -> Scan(t, title index: unicode)
       Project(body)           -> Scan(t, body index: keyword)
   ```
   
   Using the new `test_search_non_inferable` fixture (both columns are 
`VARCHAR(100)` and both contain `hello world`), with spill disabled:
   
   ```sql
   SELECT label FROM (
     SELECT title AS label FROM search_non_inferable
     EXCEPT SELECT body FROM search_non_inferable
   ) s WHERE search('label:hello');
   ```
   
   The inner EXCEPT is empty, so the result must stay empty. However, 
`PushDownFilterThroughSetOperation.addFiltersToNewChildren` copies the bound 
SEARCH into both branches and removes the outer filter; project substitution 
maps its children to title/body. The Unicode index matches token `hello`, while 
the keyword index contains only `hello world`, so the rewritten EXCEPT returns 
`hello world`. Both final scan predicates pass index validation.
   
   This is a separate route from the earlier inner-branch inference report: the 
new `NonInferableExpression` checks in `InferPredicates` never run for this 
ordinary pushdown. Preserve the subtracting input when pushing this predicate 
(or reject this unsupported outer placement), and add a result regression for 
the outer-SEARCH form.



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