wudidapaopao commented on code in PR #25536:
URL: https://github.com/apache/datafusion/pull/25536#discussion_r4065792340


##########
datafusion/optimizer/src/simplify_expressions/simplify_exprs.rs:
##########
@@ -187,7 +191,10 @@ fn rewrite_aggregate_non_aggregate_aggr_expr(
         return Ok(Transformed::no(plan));
     };
 
-    let rewrote_aggs = rewrite_multiple_linear_aggregates(&mut aggr_expr)?;
+    let rewrote_linear = rewrite_multiple_linear_aggregates(&mut aggr_expr)?;

Review Comment:
   Yes, the existing CSE already deduplicates repeated SUM or COUNT 
expressions. `rewrite_shared_aggregate_components` does not replace that 
deduplication. It determines whether decomposing AVG enables SUM or COUNT 
sharing without increasing the total number of distinct aggregate expressions, 
and only then applies the decomposition. The resulting duplicate aggregates are 
still deduplicated by the existing CSE 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