Use OwnedTableReference for subquery aliases#6022
Merged
alamb merged 6 commits intoapache:mainfrom Apr 17, 2023
Merged
Conversation
Contributor
|
I did find some previous discussion regarding this for what it's worth: #5615 (comment) @scsmithr cc @alamb |
alamb
reviewed
Apr 16, 2023
|
|
||
| /// Apply an alias | ||
| pub fn alias(self, alias: impl Into<String>) -> Result<Self> { | ||
| pub fn alias(self, alias: impl Into<OwnedTableReference>) -> Result<Self> { |
Contributor
There was a problem hiding this comment.
👍 this change makes a lot of sense to me and is consistent with creating names of other relations (like CreateExternalTable)
https://docs.rs/datafusion-expr/22.0.0/datafusion_expr/logical_plan/struct.CreateExternalTable.html
| alias: impl Into<OwnedTableReference>, | ||
| ) -> Result<Self> { | ||
| let alias = alias.into(); | ||
| let table_ref = TableReference::bare(&alias); |
Contributor
Author
|
CI errors unrelated, see #6028 Otherwise I think this is good to go. |
yjshen
approved these changes
Apr 17, 2023
r4ntix
approved these changes
Apr 17, 2023
Contributor
|
Thanks @scsmithr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #6016.
(Opening this to get early feedback)
Rationale for this change
Simplest way I found for fixing the above issue. I didn't want to try to add an analyzer rule for swapping out references in parent nodes.
What changes are included in this PR?
Changes
SubqueryAliasto hold aOwnedTableReferenceinstead of just a string.Are these changes tested?
Adds sqllogictests.
Are there any user-facing changes?
Yes, this changes the public interface for
SubqueryAlias.