string_to_timestamp_nanos_formatted

Function string_to_timestamp_nanos_formatted 

Source
pub(crate) fn string_to_timestamp_nanos_formatted(
    s: &str,
    format: &str,
) -> Result<i64, DataFusionError>
Expand description

Accepts a string with a chrono format and converts it to a nanosecond precision timestamp.

See chrono::format::strftime for the full set of supported formats.

Implements the to_timestamp function to convert a string to a timestamp, following the model of spark SQL’s to_timestamp.

Internally, this function uses the chrono library for the datetime parsing

§Timestamp Precision

Function uses the maximum precision timestamps supported by Arrow (nanoseconds stored as a 64-bit integer) timestamps. This means the range of dates that timestamps can represent is ~1677 AD to 2262 AM

§Timezone / Offset Handling

Numerical values of timestamps are stored compared to offset UTC.

Any timestamp in the formatting string is handled according to the rules defined by chrono.