Module datafusion_expr::type_coercion::binary
source · Expand description
Coercion rules for matching argument types for binary operators
Functions§
- Coerce
lhs_type
andrhs_type
to a common type for the purposes of a comparison operation Unlikecoerced_from
, usually the coerced type is for comparison only. For example, compare with Dictionary and Dictionary, only value type is what we care about - Decimal coercion rules.
- Returns the coerced input types for a binary expression evaluating the
op
with the left and right hand types - returns the resulting type of a binary expression evaluating the
op
with the left and right hand types - Returns the wider type among arguments
lhs
andrhs
. The wider type is the type that can safely represent values from both types without information loss. Returns an Error if types are incompatible. - coercion rules for like operations. This is a union of string coercion rules and dictionary coercion rules
- coercion rules for regular expression comparison operations. This is a union of string coercion rules and dictionary coercion rules
- Coerce dissimilar data types to a single data type. UNION, INTERSECT, EXCEPT, CASE, ARRAY, VALUES, and the GREATEST and LEAST functions are examples that has the similar resolution rules. See https://www.postgresql.org/docs/current/typeconv-union-case.html for more information. The rules in the document provide a clue, but adhering strictly to them doesn’t precisely align with the behavior of Postgres. Therefore, we’ve made slight adjustments to the rules to better match the behavior of both Postgres and DuckDB. For example, we expect adjusted decimal precision and scale when coercing decimal types.
- Coerce
lhs_type
andrhs_type
to a common type for value exprs