Skip to content

fix(arrow-cast): check remaining temporal cast overflows - #10907

Open
yinli-systems wants to merge 2 commits into
apache:mainfrom
yinli-systems:kevin/audit-temporal-cast-safety-10131
Open

fix(arrow-cast): check remaining temporal cast overflows#10907
yinli-systems wants to merge 2 commits into
apache:mainfrom
yinli-systems:kevin/audit-temporal-cast-safety-10131

Conversation

@yinli-systems

Copy link
Copy Markdown
Contributor

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

  • Respect CastOptions when Time64 values are narrowed to Time32.
  • Use checked multiplication for Time64(Microsecond) to Time64(Nanosecond).
  • Route Date64 precision increases through the existing checked timestamp conversion.
  • Add regressions asserting that safe casts produce nulls and unsafe casts return errors.

The original examples were fixed by #10162. This change covers the remaining audited paths: Time64(us/ns) -> Time32(s/ms), Time64(us) -> Time64(ns), and Date64 -> Timestamp(us/ns).

Validation

  • Negative control on 2c50074c: the Time64 test returned non-null truncated values, and the Date64 test panicked with attempt to multiply with overflow.
  • cargo test -p arrow-cast: 377 unit tests and 11 doctests passed.
  • cargo +stable fmt --all -- --check passed.
  • cargo clippy -p arrow-cast --all-targets --all-features -- -D warnings passed.
  • git diff upstream/main...HEAD --check passed.

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.

@github-actions github-actions Bot added arrow Changes to the arrow crate arrow-cast labels Aug 29, 2026
Comment thread arrow-cast/src/cast/mod.rs Outdated
@Jefffrey Jefffrey added the bug label Aug 29, 2026
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.
@yinli-systems
yinli-systems force-pushed the kevin/audit-temporal-cast-safety-10131 branch from 2650875 to 0fbc616 Compare September 2, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate arrow-cast bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

temporal cast overflows/panics

2 participants