seawinde commented on code in PR #61345:
URL: https://github.com/apache/doris/pull/61345#discussion_r3208805459


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/AddMinMax.java:
##########
@@ -217,8 +223,22 @@ private Expression addExprMinMaxValues(Expression expr, 
ExpressionRewriteContext
         return result;
     }
 
+    private Set<Expression> collectNonInferredPredicates(Expression expr) {
+        Set<Expression> predicates = Sets.newHashSet();
+        Deque<Expression> expressions = new ArrayDeque<>();
+        expressions.add(expr);
+        while (!expressions.isEmpty()) {

Review Comment:
       Should we stop descending once the current subtree is inferred? 
`InferPredicates` can produce `Or.withInferred(true)`, while its children may 
still have `isInferred() == false`. With the current recursion, those children 
are collected as "non-inferred
     origin predicates", so a min/max predicate generated from an inferred 
subtree can be marked as non-inferred. That seems to break the provenance this 
PR is trying to preserve. Checking `expr.isInferred()` (or 
`ExpressionUtils.isInferred(expr)`) before
     recursing should avoid that.



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