Skip to main content

Module casts

Module casts 

Source
Expand description

Utilities for casting scalar literals to different data types

This module contains functions for casting ScalarValue literals to different data types, originally extracted from the optimizer’s unwrap_cast module to be shared between logical and physical layers.

Enums§

CastPredicatePreimage
Source-domain preimage of CAST(source_expr AS target_type) OP literal.

Functions§

cast_predicate_preimage
Computes a source-domain preimage for CAST(source AS target_type) OP literal.
exact_preimage_cast
Computes a singleton source-domain literal for exact cast-predicate rewrites.
is_date_narrowing_castDeprecated
Returns true when casting a date column from from_type to to_type narrows Date64 (milliseconds) to Date32 (days).
is_supported_type
Returns true if unwrap_cast_in_comparison supports this data type
is_timestamp_precision_narrowing_cast
Returns true when casting a timestamp from source_type to target_type loses timestamp precision.
try_cast_literal_to_type
Convert a literal ScalarValue to target_type, preserving the exact value.