andygrove commented on code in PR #3407:
URL: https://github.com/apache/arrow-datafusion/pull/3407#discussion_r967193916
##########
datafusion/optimizer/src/type_coercion.rs:
##########
@@ -87,14 +89,51 @@ impl ExprRewriter for TypeCoercionRewriter {
fn mutate(&mut self, expr: Expr) -> Result<Expr> {
match expr {
- Expr::BinaryExpr { left, op, right } => {
+ Expr::BinaryExpr {
+ ref left,
+ op,
+ ref 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)?;
- Ok(Expr::BinaryExpr {
- left: Box::new(left.cast_to(&coerced_type, &self.schema)?),
- op,
- right: Box::new(right.cast_to(&coerced_type,
&self.schema)?),
+ match (&left_type, &right_type) {
+ (
+ DataType::Date32 | DataType::Date64 |
DataType::Timestamp(_, _),
+ &DataType::Interval(_),
+ ) => {
+ // Arrow `can_cast_types` says we cannot cast an
Interval to
Review Comment:
I am tracking this as part of
https://github.com/apache/arrow-datafusion/issues/3419
--
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]