Skip to content
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

Initial timezone support #903

Merged
merged 25 commits into from
May 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5baf5a3
starting to work
billylanchantin Apr 19, 2024
a5702dc
sort features
billylanchantin Apr 20, 2024
14f2f76
pass in atom
billylanchantin Apr 21, 2024
e13ebfa
better timeunit handling
billylanchantin Apr 21, 2024
9efcfbb
timezones feature
billylanchantin Apr 21, 2024
b9223fd
phase out `precision_to_timeunit`
billylanchantin Apr 21, 2024
0f9b239
datetime key additions/shuffling
billylanchantin Apr 21, 2024
763be59
formatting/linting
billylanchantin Apr 21, 2024
17e510b
start to move to a naive_datetime dtype
billylanchantin Apr 27, 2024
839e141
get datetimes back out (incorrectly)
billylanchantin Apr 27, 2024
0e07aa9
start to get timezones working
billylanchantin Apr 27, 2024
d982f13
offsets can be negative
billylanchantin Apr 27, 2024
159c166
add tz dep
billylanchantin Apr 27, 2024
d9f4564
working non-UTC timezone test
billylanchantin Apr 27, 2024
8acfcd6
get duration tests passing
billylanchantin Apr 27, 2024
dc8b624
majority of tests passing
billylanchantin Apr 27, 2024
fab6028
fix unexpected datetime parsing issue
billylanchantin Apr 28, 2024
d21baf8
make enforce_highest_precision work with different sized tuples
billylanchantin Apr 28, 2024
a06716e
add a datetime section to some duration tests
billylanchantin Apr 28, 2024
9114904
test mismatched timezones
billylanchantin Apr 28, 2024
306c789
make tz a test-only dep
billylanchantin Apr 28, 2024
5740aa9
save progress on From traits (not working!)
billylanchantin Apr 29, 2024
6c715f9
rename to s_from_list_naive_datetime
billylanchantin Apr 30, 2024
8f5be24
revert to `&'a str` type and add TODOs
billylanchantin Apr 30, 2024
c8ac63d
didn't mean to remove this
billylanchantin Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
formatting/linting
  • Loading branch information
billylanchantin committed Apr 21, 2024
commit 763be59d767db3dafcb55c491b6714cab121cfa4
3 changes: 2 additions & 1 deletion native/explorer/src/datatypes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ pub fn timestamp_to_datetime_utc(microseconds: i64) -> DateTime<Utc> {
_ => microseconds % 1_000_000,
};
let nanoseconds = remainder.abs() * 1_000;
DateTime::<Utc>::from_timestamp(seconds, nanoseconds.try_into().unwrap()).expect("construct a UTC")
DateTime::<Utc>::from_timestamp(seconds, nanoseconds.try_into().unwrap())
.expect("construct a UTC")
}

/// Converts a microsecond i64 to a `NaiveDateTime`.
Expand Down
3 changes: 2 additions & 1 deletion native/explorer/src/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use polars::prelude::{GetOutput, IntoSeries, Utf8JsonPathImpl};
use polars::series::Series;

use crate::datatypes::{
ExCorrelationMethod, ExDate, ExNaiveDateTime, ExDuration, ExRankMethod, ExSeriesDtype, ExValidValue,
ExCorrelationMethod, ExDate, ExDuration, ExNaiveDateTime, ExRankMethod, ExSeriesDtype,
ExValidValue,
};
use crate::series::{cast_str_to_f64, ewm_opts, rolling_opts};
use crate::{ExDataFrame, ExExpr, ExSeries};
Expand Down
13 changes: 5 additions & 8 deletions native/explorer/src/series.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{
atoms,
datatypes::{
ExCorrelationMethod, ExDate, ExNaiveDateTime, ExDateTime, ExDuration, ExRankMethod, ExSeriesDtype, ExTime,
ExTimeUnit, ExValidValue,
ExCorrelationMethod, ExDate, ExDateTime, ExDuration, ExNaiveDateTime, ExRankMethod,
ExSeriesDtype, ExTime, ExTimeUnit, ExValidValue,
},
encoding, ExDataFrame, ExSeries, ExplorerError,
};
Expand Down Expand Up @@ -111,13 +111,10 @@ pub fn s_from_list_datetime(
name: &str,
val: Vec<Option<ExDateTime>>,
precision: ExTimeUnit,
time_zone_str: Option<&str>
time_zone_str: Option<&str>,
) -> ExSeries {
let timeunit = TimeUnit::try_from(&precision).unwrap();
let time_zone = match time_zone_str {
None => None,
Some(string) => Some(string.to_string()),
};
let time_zone = time_zone_str.map(|s| s.to_string());

ExSeries::new(
Series::new(
Expand All @@ -135,7 +132,7 @@ pub fn s_from_list_datetime(
pub fn s_from_list_duration(
name: &str,
val: Vec<Option<ExDuration>>,
precision: ExTimeUnit
precision: ExTimeUnit,
) -> ExSeries {
let timeunit = TimeUnit::try_from(&precision).unwrap();

Expand Down