Skip to content
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

Closed
wants to merge 17 commits into from

Conversation

fiedukow
Copy link
Member

@fiedukow fiedukow commented Mar 1, 2017

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

@fiedukow fiedukow force-pushed the af/7122/2 branch 3 times, most recently from 30b5c80 to dc756c9 Compare March 6, 2017 14:42
@fiedukow
Copy link
Member Author

fiedukow commented Mar 6, 2017

Rebased to current master.

@findepi
Copy link
Contributor

findepi commented Mar 7, 2017

LGTM. Good job, @fiedukow! And thanks for keeping up with me in #7378 :)
Now to @haozhun or @martint .

@fiedukow fiedukow force-pushed the af/7122/2 branch 2 times, most recently from 6cae932 to d4905bf Compare March 10, 2017 12:11
@fiedukow
Copy link
Member Author

Rebased to master & fixed conflits.

@fiedukow fiedukow force-pushed the af/7122/2 branch 7 times, most recently from 4f41876 to 7bbf6b4 Compare March 28, 2017 15:09
@fiedukow
Copy link
Member Author

Following action where taken:

  • Updated PR with notes from doc describing changes:
    • change in TIMESTAMP -> TIMESTAMP WITH TIME ZONE cast semantic
    • restored to_iso8601 with new semantics
  • Applied changes to the doc itself.
  • Rebased PR to current master (resolved conflicts)

Are we at the point to start review or do you need something more @haozhun ?

@fiedukow fiedukow force-pushed the af/7122/2 branch 3 times, most recently from 4fa7864 to 14fed7a Compare March 30, 2017 12:46
@fiedukow
Copy link
Member Author

Rebased to master. Resolved yet another set of conflicts.

@haozhun haozhun assigned fiedukow and unassigned haozhun Aug 5, 2017
fiedukow added 11 commits August 8, 2017 11:37
This is flag for switching between legacy TIME/TIMESTAMP semantic
and new one being aligned with ANSI SQL. See: prestodb#7122
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).
@fiedukow
Copy link
Member Author

fiedukow commented Aug 8, 2017

Thanks for the first pass of the review.
I'm currently working on other TS related problem caused by incompatibility of TIMESTAMP semantics after this patch with TIMESTAMP semantics in Hive.
I'll rebase this PR soon, but will have to add some more testing and additional fix to actually make this mergeable.
I'll get to fixing your comments just after adding this patch.

@haozhun
Copy link
Contributor

haozhun commented Aug 17, 2017

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()) {
Copy link
Member Author

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.

@losipiuk
Copy link
Contributor

Superseded by #9385

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants