haohuaijin commented on code in PR #8124:
URL: https://github.com/apache/arrow-datafusion/pull/8124#discussion_r1389490760


##########
datafusion/optimizer/src/single_distinct_to_groupby.rs:
##########
@@ -89,6 +105,24 @@ fn contains_grouping_set(expr: &[Expr]) -> bool {
     matches!(expr.first(), Some(Expr::GroupingSet(_)))
 }
 
+/// Rewrite the aggregate function to two aggregate functions.
+fn aggregate_function_rewrite(
+    fun: &aggregate_function::AggregateFunction,
+) -> (
+    aggregate_function::AggregateFunction,
+    aggregate_function::AggregateFunction,
+) {
+    match fun {
+        Count => (Sum, Count),

Review Comment:
   like two phase aggregate, for `Count` aggregate, in first phase we `Count`, 
and in second phase we `Sum`.



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

Reply via email to