You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "emgeee (via GitHub)" <gi...@apache.org> on 2024/04/30 19:08:04 UTC

[PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

emgeee opened a new pull request, #10319:
URL: https://github.com/apache/datafusion/pull/10319

   ## Which issue does this PR close?
   
   Closes #10296.
   
   ## Rationale for this change
   
   ## What changes are included in this PR?
   
   
   ## 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)?
   -->
   
   ## 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.
   -->
   


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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

   In addition to updating the interface for this optimizer, I tried to remove as many copies as possible but I'm still new to rust + datafusion so I'm very much open to suggestions and feedback!


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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

   (also looks like there are some tests that need to be fixed)


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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


##########
datafusion/expr/src/expr_rewriter/mod.rs:
##########
@@ -250,7 +250,7 @@ fn coerce_exprs_for_schema(
                     _ => expr.cast_to(new_type, src_schema),
                 }
             } else {
-                Ok(expr.clone())

Review Comment:
   🚀 



-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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


##########
datafusion/optimizer/src/eliminate_nested_union.rs:
##########
@@ -37,49 +38,61 @@ impl EliminateNestedUnion {
 impl OptimizerRule for EliminateNestedUnion {
     fn try_optimize(
         &self,
-        plan: &LogicalPlan,
+        _plan: &LogicalPlan,
         _config: &dyn OptimizerConfig,
     ) -> Result<Option<LogicalPlan>> {
+        internal_err!("Should have called EliminateFilter::rewrite")

Review Comment:
   ```suggestion
           internal_err!("Should have called EliminateNestedUnion::rewrite")
   ```



-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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

   Thanks again @emgeee 


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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

   Marking as draft as I think this PR is no longer waiting on feedback. Please mark it as ready for review when it is ready for another look 


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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

   I went ahead and fixed the formatting so all tests pass and managed to remove 1 clone() call from with in the `coerce_plan_expr_for_schema()` call stack.
   
   If we want to optimize `coerce_plan_expr_for_schema` further, I'd definitely agree a separate PR makes sense as it is called from a number of other locations as well


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] Stop copying LogicalPlan and Exprs in EliminateNestedUnion [datafusion]

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


-- 
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@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org