Skip to content

Commit f538307

Browse files
committed
bump version
1 parent 83b2602 commit f538307

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/expressions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::to_julian::*;
77
use polars::prelude::*;
88
use pyo3_polars::derive::polars_expr;
99
use serde::Deserialize;
10+
use pyo3_polars::export::polars_core::datatypes::TimeZone as PolarsTimeZone;
1011

1112
#[derive(Deserialize)]
1213
pub struct FromLocalDatetimeKwargs {
@@ -37,7 +38,7 @@ pub fn from_local_datetime_output(
3738
let field = input_fields[0].clone();
3839
let dtype = match field.dtype {
3940
DataType::Datetime(unit, _) => {
40-
DataType::Datetime(unit, Some(PlSmallStr::from_str(&kwargs.to_tz)))
41+
DataType::Datetime(unit, PolarsTimeZone::opt_try_new(Some(&kwargs.to_tz))?)
4142
}
4243
_ => polars_bail!(InvalidOperation:
4344
"dtype '{}' not supported", field.dtype

src/timezone.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use arity::try_binary_elementwise;
22
use chrono::{LocalResult, NaiveDateTime, TimeZone};
3-
use polars::chunked_array::temporal::parse_time_zone;
4-
use polars::chunked_array::ChunkedArray::TimeZone as PolarsTimeZone;
3+
use pyo3_polars::export::polars_core::datatypes::time_zone::parse_time_zone;
54
use polars::prelude::*;
65
use polars_arrow::legacy::time_zone::Tz;
76
use pyo3_polars::export::polars_core::utils::arrow::legacy::kernels::Ambiguous;
87
use pyo3_polars::export::polars_core::utils::arrow::temporal_conversions::{
98
timestamp_ms_to_datetime, timestamp_ns_to_datetime, timestamp_us_to_datetime,
109
};
1110
use std::str::FromStr;
11+
use pyo3_polars::export::polars_core::datatypes::TimeZone as PolarsTimeZone;
1212

1313
fn naive_utc_to_naive_local_in_new_time_zone(
1414
from_tz: &Tz,
@@ -51,7 +51,8 @@ pub fn elementwise_to_local_datetime(
5151
datetime: &Logical<DatetimeType, Int64Type>,
5252
tz: &StringChunked,
5353
) -> PolarsResult<DatetimeChunked> {
54-
let from_time_zone = datetime.time_zone().as_deref().unwrap_or(&PlSmallStr::from("UTC"));
54+
let binding = PlSmallStr::from("UTC");
55+
let from_time_zone = datetime.time_zone().as_deref().unwrap_or(&binding);
5556
let from_tz = parse_time_zone(from_time_zone)?;
5657

5758
let timestamp_to_datetime: fn(i64) -> NaiveDateTime = match datetime.time_unit() {
@@ -142,6 +143,6 @@ pub fn elementwise_from_local_datetime(
142143
}
143144
}),
144145
};
145-
let out = out?.into_datetime(datetime.time_unit(), PolarsTimeZone{Some(PlSmallStr::from_str(out_tz))});
146+
let out = out?.into_datetime(datetime.time_unit(), PolarsTimeZone::opt_try_new(Some(out_tz))?);
146147
Ok(out)
147148
}

0 commit comments

Comments
 (0)