Module binary

Source
Expand description

Coercion rules for matching argument types for binary operators

Structs§

BinaryTypeCoercer
Provides type information about a binary expression, coercing different input types into a sensible output type.

Functions§

binary_numeric_coercion
Coerce lhs_type and rhs_type to a common type where both are numeric
binary_to_string_coercion
Coercion rules for binary (Binary/LargeBinary) to string (Utf8/LargeUtf8): If one argument is binary and the other is a string then coerce to string (e.g. for like)
comparison_coercion
Coerce lhs_type and rhs_type to a common type for the purposes of a comparison operation
comparison_coercion_numeric
Similar to comparison_coercion but prefers numeric if compares with numeric and string
decimal_coercion
Decimal coercion rules.
like_coercion
Coercion rules for like operations. This is a union of string coercion rules and dictionary coercion rules
regex_coercion
Coercion rules for regular expression comparison operations. This is a union of string coercion rules and dictionary coercion rules
string_coercion
Coercion rules for string view types (Utf8/LargeUtf8/Utf8View): If at least one argument is a string view, we coerce to string view based on the observation that StringArray to StringViewArray is cheap but not vice versa.
try_type_union_resolution
Handle type union resolution including struct type and others.
try_type_union_resolution_with_struct
type_union_resolution
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.