Skip to content

[Variant] Align cast logic between variant_get and cast kernel for temporal types (Timestamp/Date/Time) #10102

Description

@sdf-jkl

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

This is part of #8982 which wants to support the temporal types (Timestamp* incl. NTZ + timezone, Date32/Date64, Time32*/Time64*).

Currently the temporal cast logic in parquet-variant-compute (type_conversion.rs) hand-rolls conversion/truncation logic that mimics arrow-cast rather than reusing it. For example, several Time*/Timestamp* impls return None when there is leftover sub-second precision instead of truncating the way arrow-cast does (lossy is the default in the cast kernel).

Describe the solution you'd like

Align the logic of casting from/to the temporal types in parquet-variant with arrow-cast by reusing arrow-cast's scalar conversion primitives (the same approach #9688 took for decimals, where rescale_decimal / parse_string_to_decimal_native / single_float_to_decimal were exposed and reused) instead of re-implementing the logic. This keeps a single source of truth for the cast semantics and lets the perfect-shredding fast path (can_use_perfect_shredding_arrow_cast, added in #9862) be widened to cover the truncating temporal pairs it currently excludes.

Describe alternatives you've considered

Additional context

cc @klion26 @AdamGS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions