From 56cd5e9d8659445493f512e26ece14d2b0775cd5 Mon Sep 17 00:00:00 2001 From: ritchie Date: Sun, 17 Sep 2023 09:46:06 +0200 Subject: [PATCH] arrow2 0.18.0 release --- Cargo.toml | 2 +- src/io/csv/read_utils.rs | 4 ++-- src/io/odbc/read/deserialize.rs | 4 ++-- src/temporal_conversions.rs | 12 ++++++------ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1bb20a69556..58d827aaec8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arrow2" -version = "0.17.4" +version = "0.18.0" license = "Apache-2.0" description = "Unofficial implementation of Apache Arrow spec in safe Rust" homepage = "https://github.com/jorgecarleitao/arrow2" diff --git a/src/io/csv/read_utils.rs b/src/io/csv/read_utils.rs index d23f6c1197f..cb91417ed11 100644 --- a/src/io/csv/read_utils.rs +++ b/src/io/csv/read_utils.rs @@ -136,7 +136,7 @@ fn deserialize_datetime(string: &str, tz: &T) -> Option( Timestamp(time_unit, None) => deserialize_primitive(rows, column, datatype, |bytes| { to_utf8(bytes) .and_then(|x| x.parse::().ok()) - .map(|x| x.timestamp_nanos()) + .map(|x| x.timestamp_nanos_opt().unwrap()) .map(|x| match time_unit { TimeUnit::Second => x / 1_000_000_000, TimeUnit::Millisecond => x / 1_000_000, diff --git a/src/io/odbc/read/deserialize.rs b/src/io/odbc/read/deserialize.rs index 3e18fa279b7..be0a548e1a0 100644 --- a/src/io/odbc/read/deserialize.rs +++ b/src/io/odbc/read/deserialize.rs @@ -264,12 +264,12 @@ fn timestamp_ms(timestamp: &odbc_api::sys::Timestamp) -> i64 { fn timestamp_us(timestamp: &odbc_api::sys::Timestamp) -> i64 { timestamp_to_naive(timestamp) - .map(|x| x.timestamp_nanos() / 1000) + .map(|x| x.timestamp_nanos_opt().unwrap() / 1000) .unwrap_or(0) } fn timestamp_ns(timestamp: &odbc_api::sys::Timestamp) -> i64 { timestamp_to_naive(timestamp) - .map(|x| x.timestamp_nanos()) + .map(|x| x.timestamp_nanos_opt().unwrap()) .unwrap_or(0) } diff --git a/src/temporal_conversions.rs b/src/temporal_conversions.rs index b706a45b290..f2864c34179 100644 --- a/src/temporal_conversions.rs +++ b/src/temporal_conversions.rs @@ -363,7 +363,7 @@ pub fn utf8_to_timestamp_scalar( TimeUnit::Second => x.timestamp(), TimeUnit::Millisecond => x.timestamp_millis(), TimeUnit::Microsecond => x.timestamp_micros(), - TimeUnit::Nanosecond => x.timestamp_nanos(), + TimeUnit::Nanosecond => x.timestamp_nanos_opt().unwrap(), }) .ok() } else { @@ -390,7 +390,7 @@ pub fn utf8_to_naive_timestamp_scalar(value: &str, fmt: &str, tu: &TimeUnit) -> TimeUnit::Second => x.timestamp(), TimeUnit::Millisecond => x.timestamp_millis(), TimeUnit::Microsecond => x.timestamp_micros(), - TimeUnit::Nanosecond => x.timestamp_nanos(), + TimeUnit::Nanosecond => x.timestamp_nanos_opt().unwrap(), }) .ok() } @@ -515,8 +515,8 @@ pub fn add_naive_interval(timestamp: i64, time_unit: TimeUnit, interval: months_ match time_unit { TimeUnit::Second => new_datetime_tz.timestamp_millis() / 1000, TimeUnit::Millisecond => new_datetime_tz.timestamp_millis(), - TimeUnit::Microsecond => new_datetime_tz.timestamp_nanos() / 1000, - TimeUnit::Nanosecond => new_datetime_tz.timestamp_nanos(), + TimeUnit::Microsecond => new_datetime_tz.timestamp_nanos_opt().unwrap() / 1000, + TimeUnit::Nanosecond => new_datetime_tz.timestamp_nanos_opt().unwrap(), } } @@ -544,7 +544,7 @@ pub fn add_interval( match time_unit { TimeUnit::Second => new_datetime_tz.timestamp_millis() / 1000, TimeUnit::Millisecond => new_datetime_tz.timestamp_millis(), - TimeUnit::Microsecond => new_datetime_tz.timestamp_nanos() / 1000, - TimeUnit::Nanosecond => new_datetime_tz.timestamp_nanos(), + TimeUnit::Microsecond => new_datetime_tz.timestamp_nanos_opt().unwrap() / 1000, + TimeUnit::Nanosecond => new_datetime_tz.timestamp_nanos_opt().unwrap(), } }