Skip to content

Conversation

@Jefffrey
Copy link
Contributor

Which issue does this PR close?

Closes #4428

Rationale for this change

When calling with_column_renamed("old", "new") in DataFrame API, it should be able to look up "old" column name even if it is not qualified, for ease of use.

What changes are included in this PR?

If in plan there is column named t1.c1 (where t1 is the table name and c1 is the column name) then allow "c1" for old_name to be able to refer to this column without needing to explicitly state the full qualified name

Also ensure do an ambiguity check when looking up the old column name

Are these changes tested?

New unit tests added

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Apr 13, 2023
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 @Jefffrey

// table qualifier optional
.with_column_renamed("c1", "one")?
// accepts table qualifier
.with_column_renamed("aggregate_test_100.c2", "two")?
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@alamb alamb merged commit 108e9db into apache:main Apr 14, 2023
@Jefffrey Jefffrey deleted the with_column_renamed_proper_resolution branch April 14, 2023 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

with_column_renamed is always a NO OP when table name is ?table?

2 participants