haohuaijin opened a new issue, #8086: URL: https://github.com/apache/arrow-datafusion/issues/8086
### Is your feature request related to a problem or challenge? In `single_distinct_to_group_by` rule, we used [`Projection`](https://github.com/apache/arrow-datafusion/blob/0506a5cff2c61f289e805d9ecd222ce2f79e4097/datafusion/optimizer/src/single_distinct_to_groupby.rs#L236-L239) to make the schema consistent before and after optimization. The `Projection` just do the `Alias` task and , so we can directly use `Alias` in aggregate function to eliminate `Projection` and make code more clear. ### Describe the solution you'd like use `alias` instead of `projection` in `single_distinct_to_group_by` rule. the only problem is use `alias` may case a display error in explain plan, see https://github.com/apache/arrow-datafusion/pull/8061#discussion_r1383222931. but the output column name is equal, see https://github.com/apache/arrow-datafusion/pull/8061#discussion_r1385972626 ### Describe alternatives you've considered _No response_ ### Additional context _No response_ -- 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]
