datafusion_expr::binary

Function comparison_coercion

Source
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.