Skip to main content

preserves_timestamp_values

Function preserves_timestamp_values 

Source
fn preserves_timestamp_values(target: &DataType, source: &DataType) -> bool
Expand description

Returns true if a cast, or a function wrapper, that turns source into target keeps both the time unit and the underlying values of a timestamp.

A cast (or a hidden cast inside a function wrapper) that changes the time unit changes the values of the sort column, so the working ranges derived from the time index, which keep the unit of the time index, no longer apply. The optimizer conservatively rejects every cast that adds a timezone to a naive timestamp, including UTC, even though UTC has a zero offset. Only a target that keeps both the unit and the values of its source can still be the time index.