Function datafusion_expr::type_coercion::binary::coerce_types
source · pub fn coerce_types(
lhs_type: &DataType,
op: &Operator,
rhs_type: &DataType
) -> Result<DataType>
Expand description
Coercion rules for all binary operators. Returns the output type
of applying op
to an argument of lhs_type
and rhs_type
.
Returns None if no suitable type can be found.
TODO this function is trying to serve two purposes at once; it determines the result type of the binary operation and also determines how the inputs can be coerced but this results in inconsistencies in some cases (particular around date + interval) when the input argument types do not match the output argument types
Tracking issue is https://github.com/apache/arrow-datafusion/issues/3419