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 comparison
contexts — any context where two values are compared rather than
unified. This includes binary comparison operators, IN lists,
CASE/WHEN conditions, and BETWEEN.
When the two types differ, this function determines the common type to cast to.
§Numeric comparisons
The lower precision type is widened to the higher precision type
(e.g., Int32 vs Int64 → Int64).
§Numeric / String comparisons
Prefers the numeric type (e.g., '2' > 1 where 1 is Int32 coerces
'2' to Int32).
For type unification contexts (UNION, CASE THEN/ELSE), use
type_union_coercion instead.