sgrebnov opened a new pull request, #13599: URL: https://github.com/apache/datafusion/pull/13599
## Which issue does this PR close? Follow-up item for [Support unparsing plans after applying the `optimize_projections` rule PR](https://github.com/apache/datafusion/pull/13267), focusing on the unparsing enhancement to support the described scenario. With the `optimize_projections` optimization, columns are pushed down to the `TableScan`, resulting in both `Projection` and `TableScan` nodes containing projection information. As a result, the generated SQL contains a duplicate subquery, e.g., `SELECT a, b FROM (SELECT a, b FROM my_table).` ## What changes are included in this PR? PR updates `unparse_table_scan_pushdown` to prevent the creation of an additional projection if the unparser already includes a projection (`SELECT`) part. ## Are these changes tested? Yes, TPC-H, TPC-DS benchmark tests, unit tests. ## Are there any user-facing changes? Improved Plan-to-SQL conversion when a TableScan with projection information is wrapped in a Projection. -- 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]
