You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/28 06:28:02 UTC
[GitHub] [arrow-datafusion] liukun4515 commented on a diff in pull request #3636: move the `type coercion` to the beginning of the optimizer rule
liukun4515 commented on code in PR #3636:
URL: https://github.com/apache/arrow-datafusion/pull/3636#discussion_r981993529
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -50,56 +50,63 @@ impl OptimizerRule for TypeCoercion {
plan: &LogicalPlan,
optimizer_config: &mut OptimizerConfig,
) -> Result<LogicalPlan> {
- // optimize child plans first
- let new_inputs = plan
- .inputs()
- .iter()
- .map(|p| self.optimize(p, optimizer_config))
- .collect::<Result<Vec<_>>>()?;
-
- // get schema representing all available input fields. This is used for data type
- // resolution only, so order does not matter here
- let schema = new_inputs.iter().map(|input| input.schema()).fold(
- DFSchema::empty(),
- |mut lhs, rhs| {
- lhs.merge(rhs);
- lhs
- },
- );
+ optimize_internal(plan, optimizer_config)
+ }
+}
- let mut expr_rewrite = TypeCoercionRewriter {
- schema: Arc::new(schema),
- };
+fn optimize_internal(
Review Comment:
just refactor the optimize and extract the function
--
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