-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Use OwnedTableReference for subquery aliases #6022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I did find some previous discussion regarding this for what it's worth: #5615 (comment) @scsmithr cc @alamb |
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| /// Apply an alias | ||
| pub fn alias(self, alias: impl Into<String>) -> Result<Self> { | ||
| pub fn alias(self, alias: impl Into<OwnedTableReference>) -> Result<Self> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
CI errors unrelated, see #6028 Otherwise I think this is good to go. |
|
Thanks @scsmithr |
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.