HaoYang670 commented on code in PR #3721:
URL: https://github.com/apache/arrow-datafusion/pull/3721#discussion_r988486604


##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -398,6 +398,20 @@ impl ExprRewriter for TypeCoercionRewriter {
                     }
                 }
             }
+            Expr::ScalarFunction { fun, args } => match fun {
+                BuiltinScalarFunction::Concat
+                | BuiltinScalarFunction::ConcatWithSeparator => {
+                    let new_args = args

Review Comment:
   > would it make sense to check the types before clone()ing them to do a cast 
that might not be needed?
   
   I think this has been done in the `cast_to` function:
   ```rust
   fn cast_to<S: ExprSchema>(self, cast_to_type: &DataType, schema: &S) -> 
Result<Expr> {
       // TODO(kszucs): most of the operations do not validate the type 
correctness
       // like all of the binary expressions below. Perhaps Expr should track 
the
       // type of the expression?
       let this_type = self.get_type(schema)?;
       if this_type == *cast_to_type {
           Ok(self)
   ...
   }
   ```



-- 
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]

Reply via email to