Skip to main content

cast_predicate_preimage

Function cast_predicate_preimage 

Source
pub fn cast_predicate_preimage(
    source_type: &DataType,
    target_type: &DataType,
    op: Operator,
    lit_value: &ScalarValue,
) -> Result<Option<CastPredicatePreimage>>
Expand description

Computes a source-domain preimage for CAST(source AS target_type) OP literal.

This is the shared semantic core for logical and physical cast-predicate rewrites. It returns an exact same-operator source bound or literal as CastPredicatePreimage::Exact where moving the cast preserves comparison semantics subject to the documented family-level overflow exceptions, and a CastPredicatePreimage::Range for many-to-one casts with known preimages (timestamp precision narrowing) or for non-aligned timestamp widening literals.