tustvold commented on code in PR #9068:
URL: https://github.com/apache/arrow-datafusion/pull/9068#discussion_r1471052041
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -564,8 +564,34 @@ fn _date_trunc_coarse_with_tz(
granularity: &str,
value: Option<DateTime<Tz>>,
) -> Result<Option<i64>> {
- let value = _date_trunc_coarse::<DateTime<Tz>>(granularity, value)?;
- Ok(value.and_then(|value| value.timestamp_nanos_opt()))
+ if let Some(value) = value {
+ let timezone = value.timezone();
+ let offset = value.offset().fix();
+ let local = value.naive_local();
+ let value = _date_trunc_coarse::<NaiveDateTime>(granularity,
Some(local))?;
+ let value = value.map(|value| match value.and_local_timezone(timezone)
{
Review Comment:
If the intention is to effectively preserve the fixed offset of the original
timestamp, I think there should be a way to take the `NaiveDateTime` and
convert it back with the same offset?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]