-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[SPARK-10522] [SQL] Nanoseconds of Timestamp in Parquet should be positive #8674
Conversation
val secondsInDay = seconds % SECONDS_PER_DAY | ||
val nanos = (us % MICROS_PER_SECOND) * 1000L | ||
(day.toInt, secondsInDay * NANOS_PER_SECOND + nanos) | ||
val julian_us = us + JULIAN_DAY_OF_EPOCH * MICROS_PER_DAY |
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.
Without the checks I'm adding in #8606 this can overflow and write garbage to the file...
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.
We haven't handle overflow in many places, the behavior is undefined, it means will be garbage in the file, I think it's fine for now.
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.
If we throw an exception, the job will crash if there are some garbage rows in it.
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.
ok. I'll close my PR and leave the bug open.
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.
Long (2^63) is enough for 584942 years before overflow, so don't worry about it.
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.
How about adding some comments at here?
LGTM. |
Test build #42221 has finished for PR 8674 at commit
|
Merged into master and 1.5 branch (added comment while merging). |
…itive Or Hive can't read it back correctly. Thanks vanzin for report this. Author: Davies Liu <davies@databricks.com> Closes apache#8674 from davies/positive_nano. (cherry picked from commit 7e32387)
Or Hive can't read it back correctly.
Thanks @vanzin for report this.