andygrove opened a new issue, #4082: URL: https://github.com/apache/arrow-datafusion/issues/4082
**Describe the bug** The intent of SingleDistinctToGroupBy is to rewrite queries that have multiple references to the same distinct expression, such as `SELECT F1(DISTINCT s),F2(DISTINCT s)` to avoid evaluating the distinct multiple times. However, it is currently applied even if there is only a single distinct value, adding unnecessary complexity to simple queries, **To Reproduce** Only apply the rule when it is needed. **Expected behavior** **Additional context** benchmark q16 is a good example of where it is applied but not needed -- 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]
