-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
explain verbose select max(distinct(c1)) from test;
+-------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| plan_type | plan |
+-------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
| initial_logical_plan | Projection: #MAX(DISTINCT test.c1) |
| | Aggregate: groupBy=[[]], aggr=[[MAX(DISTINCT #test.c1)]] |
| | TableScan: test projection=None |
| logical_plan after simplify_expressions | SAME TEXT AS ABOVE |
| logical_plan after eliminate_filter | SAME TEXT AS ABOVE |
| logical_plan after common_sub_expression_eliminate | SAME TEXT AS ABOVE |
| logical_plan after eliminate_limit | SAME TEXT AS ABOVE |
| logical_plan after projection_push_down | Projection: #MAX(DISTINCT test.c1) |
| | Aggregate: groupBy=[[]], aggr=[[MAX(DISTINCT #test.c1)]] |
| | TableScan: test projection=Some([0]) |
| logical_plan after filter_push_down | SAME TEXT AS ABOVE |
| logical_plan after limit_push_down | SAME TEXT AS ABOVE |
| logical_plan after SingleDistinctAggregationToGroupBy | Projection: #MAX(DISTINCT test.c1) |
| | Projection: #MAX(alias1) AS MAX(DISTINCT test.c1) |
| | Aggregate: groupBy=[[]], aggr=[[MAX(#alias1)]] |
| | Aggregate: groupBy=[[#test.c1 AS alias1]], aggr=[[]] |
| | TableScan: test projection=Some([0]) Describe the solution you'd like
I think max/min don't need the rewrite, but need to eliminate the distinct.
Describe alternatives you've considered
SingleDistinctAggregationToGroupBy rule make the plan more complex.
Additional context
None
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request