Dandandan commented on code in PR #3101:
URL: https://github.com/apache/arrow-datafusion/pull/3101#discussion_r966085844
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -86,29 +87,45 @@ impl ExprRewriter for TypeCoercionRewriter {
}
fn mutate(&mut self, expr: Expr) -> Result<Expr> {
- match expr {
+ match &expr {
Expr::BinaryExpr { left, op, right } => {
let left_type = left.get_type(&self.schema)?;
let right_type = right.get_type(&self.schema)?;
- let coerced_type = coerce_types(&left_type, &op, &right_type)?;
+ let coerced_type = coerce_types(&left_type, op, &right_type)?;
Ok(Expr::BinaryExpr {
- left: Box::new(left.cast_to(&coerced_type, &self.schema)?),
- op,
- right: Box::new(right.cast_to(&coerced_type,
&self.schema)?),
+ left: Box::new(
+ left.as_ref().clone().cast_to(&coerced_type,
&self.schema)?,
+ ),
+ op: *op,
+ right: Box::new(
+ right
+ .as_ref()
+ .clone()
+ .cast_to(&coerced_type, &self.schema)?,
+ ),
})
}
+ Expr::Like { pattern, .. }
+ | Expr::ILike { pattern, .. }
+ | Expr::SimilarTo { pattern, .. } => match
pattern.get_type(&self.schema)? {
+ DataType::Utf8 => Ok(expr.clone()),
Review Comment:
What about `LargeUtf8`?
--
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]