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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]