This is an automated email from the ASF dual-hosted git repository.
viirya pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion-comet.git
The following commit(s) were added to refs/heads/main by this push:
new aa6ddc5 chore: Replace deprecated temporal methods (#229)
aa6ddc5 is described below
commit aa6ddc5df96253b1f4e77e3f977968b4f8340c6e
Author: Steve Vaughan <[email protected]>
AuthorDate: Thu Mar 28 12:15:18 2024 -0400
chore: Replace deprecated temporal methods (#229)
* chore: Handle deprecation of timestamp_micros()
* chore: Handle deprecation of seconds()
---------
Co-authored-by: Steve Vaughan Jr <[email protected]>
---
core/src/execution/datafusion/expressions/utils.rs | 2 +-
core/src/execution/kernels/temporal.rs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/core/src/execution/datafusion/expressions/utils.rs
b/core/src/execution/datafusion/expressions/utils.rs
index 30a4692..fe27f79 100644
--- a/core/src/execution/datafusion/expressions/utils.rs
+++ b/core/src/execution/datafusion/expressions/utils.rs
@@ -178,7 +178,7 @@ fn pre_timestamp_cast(array: ArrayRef, timezone: String) ->
ArrayRef {
let datetime =
as_datetime::<TimestampMicrosecondType>(value).unwrap();
let offset = tz.offset_from_utc_datetime(&datetime).fix();
let datetime = datetime + offset;
- datetime.timestamp_micros()
+ datetime.and_utc().timestamp_micros()
})
});
diff --git a/core/src/execution/kernels/temporal.rs
b/core/src/execution/kernels/temporal.rs
index 8e454fc..1868c6f 100644
--- a/core/src/execution/kernels/temporal.rs
+++ b/core/src/execution/kernels/temporal.rs
@@ -203,7 +203,7 @@ where
T: Datelike + Timelike + std::ops::Sub<Duration, Output = T> + Copy,
{
Some(dt)
- .map(|d| d - Duration::seconds(60 * 60 * 24 * d.weekday() as i64))
+ .map(|d| d - Duration::try_seconds(60 * 60 * 24 * d.weekday() as
i64).unwrap())
.and_then(|d| d.with_nanosecond(0))
.and_then(|d| d.with_second(0))
.and_then(|d| d.with_minute(0))