adriangb commented on code in PR #19252:
URL: https://github.com/apache/datafusion/pull/19252#discussion_r2619680393


##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -177,6 +177,9 @@ pub struct PhysicalGroupBy {
     /// expression in null_expr. If `groups[i][j]` is true, then the
     /// j-th expression in the i-th group is NULL, otherwise it is `expr[j]`.
     groups: Vec<Vec<bool>>,
+    /// True when GROUPING SETS/CUBE/ROLLUP are used so `__grouping_id` should
+    /// be included in the output schema.
+    has_grouping_set: bool,

Review Comment:
   Would it be better to make `groups: Option<Vec<Vec<bool>>>` and give `None` 
the meaning of `has_grouping_set: false` and `Some(vec![])` of `true`?



##########
datafusion/core/src/physical_planner.rs:
##########
@@ -1582,7 +1582,7 @@ impl DefaultPhysicalPlanner {
             }
         } else if group_expr.is_empty() {
             // No GROUP BY clause - create empty PhysicalGroupBy
-            Ok(PhysicalGroupBy::new(vec![], vec![], vec![]))
+            Ok(PhysicalGroupBy::new(vec![], vec![], vec![], false))

Review Comment:
   This constructor is now a bit hard to grok - could you decorate this call 
sight with a comment such as `--no expressions, no null expressions and no 
grouping expressions`



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