alamb commented on a change in pull request #2084:
URL: https://github.com/apache/arrow-datafusion/pull/2084#discussion_r835466791
##########
File path: datafusion/src/optimizer/single_distinct_to_groupby.rs
##########
@@ -62,6 +63,10 @@ fn optimize(plan: &LogicalPlan) -> Result<LogicalPlan> {
group_expr,
}) => {
if is_single_distinct_agg(plan) {
+ if is_max_or_min(plan) {
Review comment:
I don't think this optimization is limited to plans with a single
distinct aggregate (the way it is for count).
In other words, I think it is possible to *always* rewrite `min(distinct x)`
to `min(x) as "min(distinct x)"` and `max(distinct x)` to `max(x) as
"max(distinct x)"`
--
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]