You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "scsmithr (via GitHub)" <gi...@apache.org> on 2023/04/15 17:13:47 UTC

[GitHub] [arrow-datafusion] scsmithr opened a new pull request, #6022: Use OwnedTableReference for subquery aliases

scsmithr opened a new pull request, #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Closes #6016.
   
   (Opening this to get early feedback)
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   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.
   
   Changes
   
   # What changes are included in this PR?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   Changes `SubqueryAlias` to hold a `OwnedTableReference` instead of just a string.
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   Not yet. 
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   
   Yes, this changes the public interface for `SubqueryAlias`. 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb merged pull request #6022: Use OwnedTableReference for subquery aliases

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb merged PR #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #6022: Use OwnedTableReference for subquery aliases

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022#discussion_r1167823373


##########
datafusion/expr/src/logical_plan/plan.rs:
##########
@@ -1304,20 +1304,20 @@ pub struct SubqueryAlias {
     /// The incoming logical plan
     pub input: Arc<LogicalPlan>,
     /// The alias for the input relation
-    pub alias: String,
+    pub alias: OwnedTableReference,
     /// The schema with qualified field names
     pub schema: DFSchemaRef,
 }
 
 impl SubqueryAlias {
-    pub fn try_new(plan: LogicalPlan, alias: impl Into<String>) -> Result<Self> {
+    pub fn try_new(
+        plan: LogicalPlan,
+        alias: impl Into<OwnedTableReference>,
+    ) -> Result<Self> {
         let alias = alias.into();
-        let table_ref = TableReference::bare(&alias);

Review Comment:
   👍 



##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -381,7 +381,7 @@ impl LogicalPlanBuilder {
     }
 
     /// Apply an alias
-    pub fn alias(self, alias: impl Into<String>) -> Result<Self> {
+    pub fn alias(self, alias: impl Into<OwnedTableReference>) -> Result<Self> {

Review 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
   
   



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] Jefffrey commented on pull request #6022: Use OwnedTableReference for subquery aliases

Posted by "Jefffrey (via GitHub)" <gi...@apache.org>.
Jefffrey commented on PR #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022#issuecomment-1510048876

   I did find some previous discussion regarding this for what it's worth: https://github.com/apache/arrow-datafusion/pull/5615#discussion_r1137647079 @scsmithr 
   
   cc @alamb 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] scsmithr commented on pull request #6022: Use OwnedTableReference for subquery aliases

Posted by "scsmithr (via GitHub)" <gi...@apache.org>.
scsmithr commented on PR #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022#issuecomment-1510422327

   CI errors unrelated, see https://github.com/apache/arrow-datafusion/pull/6028
   
   Otherwise I think this is good to go.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on pull request #6022: Use OwnedTableReference for subquery aliases

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #6022:
URL: https://github.com/apache/arrow-datafusion/pull/6022#issuecomment-1511084652

   Thanks @scsmithr 


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org