-
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
Add support casting timestamp of micro/nanosecond #17689
Conversation
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.
- Please start the commit message with "Add support for..." and limit the commit title to 50 characters
- Squash both commits into one commit
- Since this a user-visible feature, add a release note describing the change
presto-main/src/main/java/com/facebook/presto/util/DateTimeUtils.java
Outdated
Show resolved
Hide resolved
The change looks good. Would this result in a perf regression for existing use cases as it tries new formats ? I can think of error cases, will have more results to try before it fails, but want to confirm your thoughts. Change the release note to |
Thanks for review. |
Today in Presto, all the timestamps are stripped to Milliseconds at the converter layer, so the precision loss is ok. but after this change, some operators will have weird behavior. "cast('2001-1-22 03:04:05.321123' as timestamp)" = "cast('2001-1-22 03:04:05.321999' as timestamp)" Since this is already happening other places at the connector, this precision loss is ok. |
Let us wait for @prithvip to approve as well, then we can merge this. Give it a couple of days. |
@fengpengyuan Thank you very much for contributing this change. The code looks good to me, but could you please edit your initial comment to follow our release notes guidelines? https://github.com/prestodb/presto/wiki/Release-Notes-Guidelines |
@fengpengyuan Thank you for updating the release notes. @arunthirupathi Let's go ahead and merge this. |
Some tables would have date time formats (columns of VARCHAR type) with microsecond or nanosecond precision. When trying to cast these to TIMESTAMP type, Presto will throw a cast error. We should support casting these higher precision date time formats to timestamp for better usability of Presto. Since timestamp only supports millisecond precision, the behavior of the casting should be to truncate to millisecond precision.
Test plan - Unit tests