Skip to content

Conversation

@bert-beyondloops
Copy link
Contributor

@bert-beyondloops bert-beyondloops commented Jul 7, 2025

Which issue does this PR close?

Rationale for this change

Schema of logical plan should be the same as the associated physical plan.

What changes are included in this PR?

  1. The logical plan schema() method for a CopyTo plan has been changed.
  2. Construction of the CopyTo structure has been replaced with a "new" method and all callers have been updated.
  3. A new test has been written to verify equality of the schemas of the CopyTo logical plan with the associated physical plan. See test_copy_schema on dataframe level. e0e88a1#diff-4a599584dfc900ec21169f4f820a1b1db46b004b77533dab83a6178d5d3a467eR6143

Are these changes tested?

A new test has been written to verify that both the logical plan as the physical plan return the same schema.

Are there any user-facing changes?

On SQL level, there is no change ; you cannot construct a sql statement where a CopyTo logical plan is child from another plan.

On dataframe level, retrieving the schema of a CopyTo logical plan will provide a correct schema now.

@github-actions github-actions bot added sql SQL Planner logical-expr Logical plan and expressions core Core DataFusion crate proto Related to proto crate labels Jul 7, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me -- thank you @bert-beyondloops

@alamb alamb changed the title Fix: CopyTo logical plan outputs 1 column Fix: Make CopyTo logical plan output schema consistent with physical schema Jul 7, 2025
@bert-beyondloops bert-beyondloops force-pushed the copy_to-output-schema branch from fabde80 to 3b5387b Compare July 7, 2025 16:35
@bert-beyondloops bert-beyondloops force-pushed the copy_to-output-schema branch from 3b5387b to 40d3122 Compare July 7, 2025 16:39
@bert-beyondloops
Copy link
Contributor Author

unused import removed.

@alamb alamb merged commit 2093551 into apache:main Jul 8, 2025
27 checks passed
@alamb
Copy link
Contributor

alamb commented Jul 8, 2025

Thanks again @bert-beyondloops

@bert-beyondloops bert-beyondloops deleted the copy_to-output-schema branch October 15, 2025 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate logical-expr Logical plan and expressions proto Related to proto crate sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Output schema of the CopyTo logical plan is not correct.

2 participants