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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferAggNotNull.java:
##########
@@ -108,8 +108,7 @@ private Set<Expression> inferFunctionNotNulls(
 
     private boolean canInferFunctionNotNull(AggregateFunction 
aggregateFunction) {
         return isSupportedAggregateFunction(aggregateFunction)
-                && !aggregateFunction.children().isEmpty()
-                && 
ExpressionUtils.isCheapEnoughToInferNotNull(aggregateFunction.children());
+                && !aggregateFunction.children().isEmpty();

Review Comment:
   [P1] Keep partial aggregate inference from moving volatile evaluation
   
   For the normalized plan
   ```text
   Aggregate[count(DISTINCT r, R.c0, ..., R.c31)]
     Project[(random(1) > 0.5) AS r, R.c0, ..., R.c31]
       LEFT_OUTER_JOIN(L, R)
   ```
   the former aggregate-wide 32-slot gate produced no inferred filter. This 
change accepts 32 children and creates generated `R.c_i IS NOT NULL` 
predicates. `PushDownFilterThroughProject` keeps the predicate on volatile 
alias `r` above the project, but pushes the pass-through `R.c_i` predicates 
below it; `EliminateOuterJoin` then permanently changes the child to INNER.
   
   The variadic COUNT skips unmatched rows because a right-side argument is 
NULL, but the original project still advanced seeded `random` for those rows. 
After the rewrite, they disappear before the project, shifting the values 
assigned to matched duplicate tuples and potentially changing the distinct 
count. Please retain aggregate-wide rejection for over-budget children (or 
otherwise prevent these generated predicates from crossing an 
evaluation-sensitive project/cardinality boundary), and add a full-rewrite 
result regression for this path.
   



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