neilconway opened a new pull request, #24977: URL: https://github.com/apache/datafusion/pull/24977
## Which issue does this PR close? - N/A ## Rationale for this change Reduce redundant work in `EliminateDuplicatedExpr` with two independent optimizations: 1. Before deduplication, return immediately for zero or one grouping expression. These lists cannot contain duplicate entries, so avoid constructing the deduplication set as well. 2. After deduplication, reuse the Aggregate if no grouping expressions were removed. This avoids repeating validation, schema construction, and functional-dependency derivation. This improves query optimizer performance on the TPC-H and TPC-DS queries by about 5%. ## What changes are included in this PR? * Implement both optimizations described above * Add unit tests ## What is the testing strategy for this PR? Existing tests pass. New unit tests added to (1) confirm existing behavior (duplicate removal) (2) confirm optimization (schema reused when no duplicate removal work needs to be done). I checked that the tests in category (2) fail if the optimization is disabled. ## Are there any user-facing changes? No. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
