waitingkuo commented on issue #4106:
URL:
https://github.com/apache/arrow-datafusion/issues/4106#issuecomment-1304498803
> @waitingkuo thank you for your clear communication as always! You have the
most reviewable PRs and issues I've seen 😄 .
❤️
>
> The issue looks good to me, but I would propose tackling in stages:
>
> 1. Allow things like `set time zone to '+08:00';` as described
> 2. Allow `set time zone to 'US/Mountain';` or `set time zone to
'US/Denver';` or `set time zone to 'MT';`
>
> This is due to the extra complication of what to do when someone does a
`select TO_TIMESTAMP('2022-11-06T01:30:00');` and the server timezone is
'US/Mountain' and there are two distinct 1:30AMs one in MDT and one in MST. Do
we know what postgres does here? The only sensible thing I can think to do is
fail the query with an error.
PostgreSQL's `to_timestamp` ouputs `timestamp with time zone`
https://www.postgresql.org/docs/current/functions-formatting.html
```bash
to_timestamp ( text, text ) → timestamp with time zone
Converts string to time stamp according to the given format.
to_timestamp('05 Dec 2000', 'DD Mon YYYY') → 2000-12-05 00:00:00-05
```
```bash
willy=# set timezone to 'America/Denver';
SET
willy=# select to_timestamp('05 Dec 2000', 'DD Mon YYYY');
to_timestamp
------------------------
2000-12-05 00:00:00-07
(1 row)
```
it shows the fixed offset timezone. i think there's no ambiguity in this
approach.
The `TO_TIMESTAMP` for datafusion for now outputs `Timestamp<TimeUnit,
None>`.
https://github.com/apache/arrow-datafusion/blob/6d00bd990ce5644181ad1549a6c70c8406219070/datafusion/expr/src/function.rs#L206-L220
I think it will make more sense if these `TO_TIMESTSMP_XX` functions change
the signatures to Timestamp with Timezone. This is in my backlog as well . I
was working on #2979 to align `TO_TIMESTAMP` to Postgrseql's but found that we
don't have timezone support. So I moved the focus to finish the time zone
support (from sqlparser, arrow-rs, and finally datafusion 😃 )
--
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]