Skip to content

Commit

Permalink
chore: Replace deprecated temporal methods (apache#229)
Browse files Browse the repository at this point in the history
* chore: Handle deprecation of timestamp_micros()

* chore: Handle deprecation of seconds()

---------

Co-authored-by: Steve Vaughan Jr <s_vaughan@apple.com>
  • Loading branch information
snmvaughan and Steve Vaughan Jr authored Mar 28, 2024
1 parent 9d3d7b8 commit aa6ddc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/execution/datafusion/expressions/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
});

Expand Down
2 changes: 1 addition & 1 deletion core/src/execution/kernels/temporal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit aa6ddc5

Please sign in to comment.