Dandandan commented on code in PR #7542:
URL: https://github.com/apache/arrow-datafusion/pull/7542#discussion_r1324142858
##########
datafusion/core/src/physical_plan/aggregates/mod.rs:
##########
@@ -567,6 +567,34 @@ fn calc_required_input_ordering(
Ok((!required_input_ordering.is_empty()).then_some(required_input_ordering))
}
+/// Check whether group by expression contains all of the expression inside
`requirement`
+// As an example Group By (c,b,a) contains all of the expressions in the
`requirement`: (a ASC, b DESC)
+fn group_by_contains_all_requirements(
+ group_by: &PhysicalGroupBy,
+ requirement: &LexOrdering,
+) -> bool {
+ // single group by expressions
+ if group_by.groups.len() <= 1 {
Review Comment:
Could this be written as something like?
`group_by.groups.len() <= 1 && requirement.iter().all(|req|
physical_exprs_contains(&physical_exprs, &req.expr))`
--
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]