jorgecarleitao / arrow2

Transmute-free Rust library to work with the Arrow format
Apache License 2.0
1.07k stars 223 forks source link

Fixed timestamp to datetime conversion error #1468

Closed alexander-beedie closed 1 year ago

alexander-beedie commented 1 year ago

Follow-up to the previous PR, which was incomplete; this update now properly handles both fractional and non-fractional pre-epoch (negative) value conversions. Apologies for missing this first time round 😅

Added new tests to ensure that both cases are properly covered.

(Note that div_floor hasn't been standardised yet[^1], so this checks the remainder and applies the equivalent "-1" adjustment for fractional seconds in the negative timestamp case; default behaviour is round-to-zero, meaning we'd otherwise be off by one second).

[^1]: Tracking Issue for int_roundings: https://github.com/rust-lang/rust/issues/88581

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 :warning:

Comparison is base (1034825) 83.93% compared to head (d89d9d6) 83.92%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1468 +/- ## ========================================== - Coverage 83.93% 83.92% -0.01% ========================================== Files 387 387 Lines 41620 41623 +3 ========================================== Hits 34934 34934 - Misses 6686 6689 +3 ``` | [Impacted Files](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1468?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) | Coverage Δ | | |---|---|---| | [src/temporal\_conversions.rs](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1468?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao#diff-c3JjL3RlbXBvcmFsX2NvbnZlcnNpb25zLnJz) | `91.47% <100.00%> (+0.08%)` | :arrow_up: | ... and [5 files with indirect coverage changes](https://codecov.io/gh/jorgecarleitao/arrow2/pull/1468/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao) Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Jorge+Leitao)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.