[SPARK-28596][SQL] Use Java 8 time API in the date_trunc() function#25329
Closed
MaxGekk wants to merge 2 commits into
Closed
[SPARK-28596][SQL] Use Java 8 time API in the date_trunc() function#25329MaxGekk wants to merge 2 commits into
MaxGekk wants to merge 2 commits into
Conversation
|
Test build #108526 has finished for PR 25329 at commit
|
Member
Author
Member
|
Thank you for the benchmark, @MaxGekk . I also didn't expect the slowdown. When you close this PR, could you add a comment about this? (You can point the above comment.) That would be helpful when we revisit this with JDK11. |
Member
Author
|
I linked this to Build and Run Spark on JDK11 |
Member
Author
|
I am closing this PR because new implementation based on Java 8 API slows down date/timestamp truncations up to 3 times ( see details #25329 (comment)). SPARK-28596 has been linked to SPARK-24417 to try it on JDK11. |
Member
|
Thank you for linking to JDK11. That will remind us definitely. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What changes were proposed in this pull request?
In the PR, I propose to re-implement
DateTimeUtils.truncTimestampand use Java 8 time API to adjust timestamps toYEAR,MONTH,QUARTER,WEEK,DAY,HOUR,MINUTEandSECOND. This simplifies implementation and will allow to easily support other level of truncation, see https://issues.apache.org/jira/browse/SPARK-28017.Also I pass
ZoneIdinstances to the function instead ofTimeZoneinstances to avoid unnecessary conversions.How was this patch tested?
By existing test suites. I am going to re-run the
DateTimebenchmark.