-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIME/TIMESTAMP W/O TIME ZONE semantics fix (#7122) - continuation #7480
Conversation
dacc1aa
to
85fa207
Compare
30b5c80
to
dc756c9
Compare
Rebased to current master. |
6cae932
to
d4905bf
Compare
Rebased to master & fixed conflits. |
4f41876
to
7bbf6b4
Compare
Following action where taken:
Are we at the point to start review or do you need something more @haozhun ? |
4fa7864
to
14fed7a
Compare
Rebased to master. Resolved yet another set of conflicts. |
This is flag for switching between legacy TIME/TIMESTAMP semantic and new one being aligned with ANSI SQL. See: prestodb#7122
+ Improve test coverage
AT TIME ZONE does not take into account the fact, that TIME WITH TIME ZONE does not represent real millisecond UTC in millisUtc field. In fact, this field contains millisUtc assuming offset of TIME ZONE that was valid on 1970-01-01. Such representation allows to simply represent local time with time zone id. That means that TIME WITH TIME ZONE that represents eg. '10:00:00.000 Asia/Kathmandu' will always represent this exact value. However mapping of such value to other TZ (including UTC) may differ over time. Eg. Asia/Kathmandu switched time zone offset on 1986 from +5:30 to +5:45. Result of query like: `SELECT time_with_tz_column FROM table;` Will always be the same, however: `SELECT time_with_tz_column AT TIME ZONE 'UTC' FROM table;` Will yail differnet value in 1980 and 2000 after changes from this commit. This is done to use current offset of TZ as function that stucked in 1970-01-01 offsets seems useless. This is not perfect solution and is not fully aligned with standard, but standard behavior cannot be achieved with current TIME WITH TIME ZONE representation, as we are not able to read TZ offset from TIME WITH TIME ZONE itselve (at least not in all cases).
Thanks for the first pass of the review. |
Using this will allow to write simpler tests and avoid intermittent error caused by DST or changes in time zone policies. Without this change some test would require to rewrite to much logic from implementation making them less usefull.
Please assign back to me when this is ready for review again. |
@@ -39,7 +39,12 @@ public Object getObjectValue(ConnectorSession session, Block block, int position | |||
return null; | |||
} | |||
|
|||
return new SqlTimestamp(block.getLong(position, 0), session.getTimeZoneKey()); | |||
if (session.isLegacyTimestamp()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment in header of this class is invalid and should be changed.
Superseded by #9385 |
This is continuation of #7378 and more complete solution for #7122.
Please follow this doc for detailed documentation of changes applied:
https://docs.google.com/document/d/1UUDktZDx8fGwHZV4VyaEDQURorFbbg6ioeZ5KMHwoCk/edit?usp=sharing
Commenting is enabled one this doc, so please feel free to express your concerns.
CC: @martint @haozhun @dain @losipiuk @findepi @ilfrin