pola-rs / polars

Dataframes powered by a multithreaded, vectorized query engine, written in Rust
https://docs.pola.rs
Other
30.52k stars 1.98k forks source link

fix(rust): Fix datetime cast behavior for pre-epoch times #19949

Open ptiza opened 23 hours ago

ptiza commented 23 hours ago

Fixes #19309

See also my comment https://github.com/pola-rs/polars/issues/19309#issuecomment-2495681651

Error was introduced with #14026

Pre-epoch timestamps are negative, if we trunc div instead of floor div here, we get an incorrect distance to epoch.

codecov[bot] commented 22 hours ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 79.47%. Comparing base (8facee9) to head (0094cc4). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #19949 +/- ## ========================================== + Coverage 79.45% 79.47% +0.01% ========================================== Files 1555 1555 Lines 216168 216320 +152 Branches 2456 2456 ========================================== + Hits 171760 171910 +150 - Misses 43850 43852 +2 Partials 558 558 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.


🚨 Try these New Features:

MarcoGorelli commented 14 hours ago

thanks @ptiza - could you add a test please? the one from the linked issue is fine

MarcoGorelli commented 10 hours ago

thanks - @orlp fancy taking a look?