Skip to main content

is_timestamp_precision_narrowing_cast

Function is_timestamp_precision_narrowing_cast 

Source
pub fn is_timestamp_precision_narrowing_cast(
    from_type: &DataType,
    to_type: &DataType,
) -> bool
Expand description

Returns true when casting a timestamp from from_type to to_type loses timestamp precision.

This is used by comparison cast unwrapping to avoid rewrites such as CAST(ts_ns AS timestamp(ms)) = lit_ms -> ts_ns = lit_ns. The original predicate can match any nanosecond value in the same millisecond, while the rewritten predicate only matches the exact millisecond boundary.