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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicateByReplace.java:
##########
@@ -210,7 +236,9 @@ public static Set<Expression> infer(Set<Expression> inputs) 
{
         }
         Map<Expression, Set<Expression>> exprPredicates = new HashMap<>();
         for (Expression input : inputs) {
-            if (input.anyMatch(expr -> !((ExpressionTrait) 
expr).isDeterministic())
+            // Inference can evaluate a predicate on rows that never reach its 
original filter.
+            if (input.anyMatch(expr -> expr instanceof NoneMovableFunction

Review Comment:
   [P1] Fence deterministic expressions that can fail on extra rows
   
   This check only covers functions already marked `NoneMovableFunction`, but 
deterministic functions can also expose row-dependent errors when inference 
evaluates them on the other join input. For example, the reduced plan
   
   ```text
   InnerJoin(l.a = r.b)
     Filter(bitmap_count(to_bitmap_with_check(l.a)) > 0)
       Scan L(a={1})
     Scan R(b={-1,1})
   ```
   
   indexes the unary predicate under `l.a`; exact-BIGINT replacement then 
creates the same predicate on `r.b`, and `InferPredicates` installs it above R. 
The original plan returns the `1=1` match, but the inferred filter evaluates 
the unmatched `b=-1`, for which BE's `ToBitmapWithCheck` returns 
`InvalidArgument`. This is distinct from the existing `assert_true` thread 
because `ToBitmapWithCheck` does not implement `NoneMovableFunction` and 
therefore passes the newly added guard. Please require a general 
safe-on-additional-rows/total-expression property (or mark and audit all 
status-error functions) and add this unmatched-row regression.



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