pub fn comparison_coercion(
lhs_type: &DataType,
rhs_type: &DataType,
) -> Option<DataType>Expand description
Coerce lhs_type and rhs_type to a common type for the purposes of a
comparison operation
Example comparison operations are lhs = rhs and lhs > rhs
Binary comparison kernels require the two arguments to be the (exact) same data type. However, users can write queries where the two arguments are different data types. In such cases, the data types are automatically cast (coerced) to a single data type to pass to the kernels.
§Numeric comparisons
When comparing numeric values, the lower precision type is coerced to the
higher precision type to avoid losing data. For example when comparing
Int32 to Int64 the coerced type is Int64 so the Int32 argument will
be cast.
§Numeric / String comparisons
When comparing numeric values and strings, both values will be coerced to
strings. For example when comparing '2' > 1, the arguments will be
coerced to Utf8 for comparison