mhilton opened a new issue, #11471:
URL: https://github.com/apache/arrow-rs/issues/11471
### Is your feature request related to a problem or challenge?
I've been looking at how datafusion's `date_bin` function should be made
timezone aware and the code would become simpler if arrow's `Tz` type had
direct support for performing timezone conversions on the arrow native
timestamp types.
### Describe the solution you'd like
I would like to add two new methods to `Tz`:
- `pub fn utc_to_local<T: ArrowTimestampType>(utc: T::Native) ->
Option<T::Native>`
- `pub fn local_to_utc<T: ArrowTimestampType>(local: T::Native) ->
LocalResult<T::Native>`
I suspect in support of the above we would also want similar functions on
`TzOffset`:
- `pub fn utc_to_local<T: ArrowTimestampType>(utc: T::Native) ->
Option<T::Native>`
- `pub fn local_to_utc<T: ArrowTimestampType>(local: T::Native) ->
Option<T::Native>`
And most likely a helper function on `ArrowTimestampType` as well:
- `fn to_utc_datetime(utc: Self::Native) -> Option<DateTime<Utc>>`
### Describe alternatives you've considered
The main alternative is to keep all the logic in datafusion, but these
methods seem to be generally useful enough that they are worth having.
### 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]