xavlee commented on code in PR #24497:
URL: https://github.com/apache/datafusion/pull/24497#discussion_r4516088224


##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -1025,13 +1024,18 @@ impl AggregateExec {
             })
             .collect();
 
-        let num_non_constant_groupby_exprs = groupby_exprs
+        let has_non_constant_groupby_exprs = groupby_exprs
             .iter()
-            .filter(|expr| 
input_eq_properties.is_expr_constant(expr).is_none())
-            .count();
-        let mut group_clustering_mode = if indices.len() == 
num_non_constant_groupby_exprs
-            && !indices.is_empty()
-            && group_by.groups.len() == 1
+            .any(|expr| input_eq_properties.is_expr_constant(expr).is_none());
+        // Grouping sets can change group keys. PartialReduce combines 
intermediate
+        // states without using group boundaries to recognize completed groups.
+        let group_clustering_mode = if group_by.has_grouping_set()
+            || group_by.groups.len() != 1

Review Comment:
   I updated the guard here, thanks Jay 



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