Dandandan opened a new pull request, #27651: URL: https://github.com/apache/datafusion/pull/27651
## Rationale OptimizeProjections can revisit an already-projected scan and reconstruct schemas for aggregate and window expressions that survived a previous pass. This adds fast paths to those cases. Related work includes #24281 and #23686. ## Change Reuse a scan when its mapped projection is identical, including traversal of subqueries in its filters. For aggregates and windows, reuse the existing output fields when all expressions were retained in order and the optimized input has the same schema object. The aggregate constructor still validates the grouping fields and derives functional dependencies. Changed projections and child schemas follow the existing construction path. ## Local Parquet results TPC-DS SF1, unchanged SQL and seven alternating fresh-process pairs against 77611de53. The isolated measurements call SessionState::optimize on an already parsed logical plan with registered Parquet tables. Results are median milliseconds across process medians. | Query | Base optimizer | Draft optimizer | Faster pairs | Base SQL | Draft SQL | |---|---:|---:|---:|---:|---:| | Q49 | 4.240 | 4.024 | 7/7 | 45.5 | 43.5 | | Q80 | 3.725 | 3.580 | 7/7 | 73.0 | 74.5 | | Q77 | 2.641 | 2.557 | 6/7 | 31.0 | 29.0 | The end-to-end measurements used separate release CLIs with ten target partitions, five query executions per process and the first execution discarded. All result rows matched. The repeatable improvement is in logical optimization. Added a regression test for schema reuse on a second visit to a projected scan. AI-assisted implementation and local validation. -- 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]
