diff --git a/core/src/execution/datafusion/expressions/utils.rs b/core/src/execution/datafusion/expressions/utils.rs index 30a469207..fe27f796c 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::(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 8e454fc9e..1868c6fe5 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 + 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))