You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/07/09 13:23:08 UTC
[I] Add `to_local_time` function for converting timestamps with timezones to timestmaps without timezones [datafusion]
alamb opened a new issue, #11358:
URL: https://github.com/apache/datafusion/issues/11358
### Is your feature request related to a problem or challenge?
The actual need is implementing `date_bin` that correctly bins dates on timezone correct timestamps (e.g. not UTC) as described by @Abdullahsab3 in https://github.com/apache/datafusion/issues/10368
This ticket tracks adding the `to_local_time` function portion of @Abdullahsab3 's suggestion in DataFusion while we work on getting consensus if we want to change the semantics of the arrow cast kernel: https://github.com/apache/arrow-rs/pull/5826
### Describe the solution you'd like
Add function to_local_time that takes a timestamp/column as an argument, and a timezone as another argument. For example
```sql
> select to_local_time('2020-11-30T08:00:00.000Z'::timestamp, 'Europe/Brussels');
-- translates to '2020-11-30T08:00:00.000Z'::timestamp + interval '1 hour'
< '2020-11-30T09:00:00'
```
The difference between this and the at time zone operator is:
The at time zone operator seems to be only adding timezone/offset information to the timestamp if I understood correctly. the proposed to_local_time function should ideally apply that offset to the provided timestamp. The same example above would be:
```sql
> select '2020-11-30T08:00:00.000Z'::timestamp at time zone 'Europe/Brussels';
+----------------------------------+
| Utf8("2020-11-30T08:00:00.000Z") |
+----------------------------------+
| 2020-11-30T08:00:00+01:00 |
+----------------------------------+
1 row in set. Query took 0.002 seconds.
```
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
--
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: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Add `to_local_time` function for converting timestamps with timezones to timestmaps without timezones [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #11358: Add `to_local_time` function for converting timestamps with timezones to timestmaps without timezones
URL: https://github.com/apache/datafusion/issues/11358
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org