Repository navigation
fix(arrow-cast): check remaining temporal cast overflows - #10907
Conversation
Respect CastOptions when Time64 conversions narrow or multiply and when Date64 conversions increase timestamp precision. Safe casts produce nulls for overflowing values, while unsafe casts return errors. Tests: - cargo test -p arrow-cast - cargo +stable fmt --all -- --check - cargo clippy -p arrow-cast --all-targets --all-features -- -D warnings AI assistance: Codex assisted with auditing the temporal cast paths and preparing the implementation and tests. Human review is required before submission.
2650875 to
0fbc616
Compare
Signed-off-by: Kevin-Li-2025 <[email protected]>
|
Added focused boundary coverage in Validation on the current head: |
|
@Jefffrey, when convenient, could you take another look? The allocation concern is addressed by the single-pass casts, the follow-up adds focused boundary/null/slice coverage, and all 40 current checks are green. No further changes are pending from my side. |
|
thanks @yinli-systems, sorry it took time to get back to this |
Fixes #10131.
Human review and ownership
I reviewed the final diff and understand the checked conversion approach, the safe and unsafe cast semantics, and the regression coverage. I can debug and own this change.
Summary
CastOptionswhenTime64values are narrowed toTime32.Time64(Microsecond)toTime64(Nanosecond).Date64precision increases through the existing checked timestamp conversion.The original examples were fixed by #10162. This change covers the remaining audited paths:
Time64(us/ns) -> Time32(s/ms),Time64(us) -> Time64(ns), andDate64 -> Timestamp(us/ns).Validation
2c50074c: the Time64 test returned non-null truncated values, and the Date64 test panicked withattempt to multiply with overflow.cargo test -p arrow-cast: 377 unit tests and 11 doctests passed.cargo +stable fmt --all -- --checkpassed.cargo clippy -p arrow-cast --all-targets --all-features -- -D warningspassed.git diff upstream/main...HEAD --checkpassed.AI assistance
Codex assisted with auditing temporal conversion paths, preparing the implementation and regression tests, updating the branch onto current
main, and running the validation above. The contributor reviewed the final diff and confirmed understanding and ownership before submission.