-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(rust): date_range with unit microseconds was producing incorrect results #9413
Conversation
7584c4f
to
4e46771
Compare
4e46771
to
438ea2c
Compare
TimeUnit::Nanoseconds => (start.timestamp_nanos(), stop.timestamp_nanos()), | ||
TimeUnit::Microseconds => ( | ||
start.timestamp() + start.timestamp_subsec_micros() as i64, | ||
stop.timestamp() + stop.timestamp_subsec_millis() as i64, | ||
), | ||
TimeUnit::Microseconds => (start.timestamp_micros(), stop.timestamp_micros()), | ||
TimeUnit::Milliseconds => (start.timestamp_millis(), stop.timestamp_millis()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the difference was introduced in https://github.com/pola-rs/polars/pull/2711/files, but I can't tell why - @ritchie46 do you happen to remember?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, no idea. It has been a while. :)
TimeUnit::Nanoseconds => (start.timestamp_nanos(), stop.timestamp_nanos()), | ||
TimeUnit::Microseconds => ( | ||
start.timestamp() + start.timestamp_subsec_micros() as i64, | ||
stop.timestamp() + stop.timestamp_subsec_millis() as i64, | ||
), | ||
TimeUnit::Microseconds => (start.timestamp_micros(), stop.timestamp_micros()), | ||
TimeUnit::Milliseconds => (start.timestamp_millis(), stop.timestamp_millis()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, no idea. It has been a while. :)
polars/polars-time/src/date_range.rs
Outdated
@@ -110,3 +107,84 @@ pub fn time_range( | |||
let stop = time_to_time64ns(&stop); | |||
time_range_impl(name, start, stop, every, closed) | |||
} | |||
|
|||
#[cfg(test)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these tests to the integration
tests? This will save a lot of compile times as every test module is compiled in a separate binary. In the aggregation tests we can accumulate that.
closes #9409