Skip to main content

is_date_narrowing_cast

Function is_date_narrowing_cast 

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

Returns true when casting a date column from from_type to to_type narrows Date64 (milliseconds) to Date32 (days).

Like is_timestamp_precision_narrowing_cast, this guards comparison cast unwrapping against a many-to-one column cast. CAST(date64 AS Date32) = lit_day matches any millisecond within that day, but the rewritten date64 = lit_ms matches only midnight. Arrow does not require Date64 values to be whole days (see arrow-rs#5288), so the column may carry sub-day values the planner cannot see; the widening direction (Date32 -> Date64) is injective and stays allowed.