-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Description
Your Environment
- Presto version used: 0.293
Expected Behavior
TIME and TIME WITH TIMEZONE should respect day light savings time based on the timezone in effect.
presto:default> select TIME '00:00 America/Los_Angeles' - TIME '00:00 UTC';
_col0
----------------
0 07:00:00.000
localtime and current_time should also respect DST if in a DST time zone.
presto:default> select localtime;
_col0
--------------
11:17:10.819
(1 row)
presto:default> select current_time;
_col0
----------------------------------
11:18:27.494 America/Los_Angeles
(1 row)
Current Behavior
TIME and TIME WITH TIMEZONE do not respect day light savings time . There are also other inconsistencies which I will list below.
presto:default> select TIME '00:00 America/Los_Angeles' - TIME '00:00 UTC';
_col0
----------------
0 08:00:00.000
However currently the time zone displacement between UTC and America/Los_Angeles is 7 hours and not 8.
This can be further illustrated by running localtime and current time in any DST timezone.
My current time is 11:17 PST.
presto:default> select localtime;
_col0
--------------
10:17:10.819
(1 row)
presto:default> select current_time;
_col0
----------------------------------
10:18:27.494 America/Los_Angeles
(1 row)
As you can see these results are off by 1 hour due to not account DST.
Another problem is when casting time to timestamp.
presto:default> select cast(current_time as timestamp);
_col0
-------------------------
1970-01-01 10:51:52.253
(1 row)
The above can be very misleading to a lot of consumers.
Possible Solution
TIME and TIME WITH TIMEZONE should take into account DST.
Proposed document which outlines behavior and proposed changes : https://docs.google.com/document/d/1m73xx2FqyoqWSH4DO2FO5yVdkSgKbtk51J3Nf_f9GXk/edit?tab=t.0 .
Context
Velox is working on implementing TIME and TIME with TIMEZONE here : facebookincubator/velox#14633 and we are looking to support it taking into account DST.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status