Skip to content

Commit f81fb7c

Browse files
committed
update comments and link to follow-on issue
1 parent e1a0ab6 commit f81fb7c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

datafusion/expr/src/binary_rule.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ pub fn binary_operator_data_type(
7272

7373
/// Coercion rules for all binary operators. Returns the output type
7474
/// of applying `op` to an argument of `lhs_type` and `rhs_type`.
75+
///
76+
/// TODO this function is trying to serve two purposes at once; it determines the result type
77+
/// of the binary operation and also determines how the inputs can be coerced but this
78+
/// results in inconsistencies in some cases (particular around date + interval)
79+
///
80+
/// Tracking issue is https://github.com/apache/arrow-datafusion/issues/3419
7581
pub fn coerce_types(
7682
lhs_type: &DataType,
7783
op: &Operator,

datafusion/optimizer/src/type_coercion.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ impl ExprRewriter for TypeCoercionRewriter {
101101
DataType::Date32 | DataType::Date64 | DataType::Timestamp(_, _),
102102
&DataType::Interval(_),
103103
) => {
104-
// Arrow `can_cast_types` says we cannot cast an Interval to
105-
// Date32/Date64/Timestamp, which contradicts DataFusion's `coerce_types`
104+
// this is a workaround for https://github.com/apache/arrow-datafusion/issues/3419
106105
Ok(expr.clone())
107106
}
108107
_ => {

0 commit comments

Comments
 (0)