[SPARK-31867][SQL][FOLLOWUP] Check result differences for datetime formatting#28736
Closed
yaooqinn wants to merge 3 commits intoapache:masterfrom
yaooqinn:SPARK-31867-F
Closed
[SPARK-31867][SQL][FOLLOWUP] Check result differences for datetime formatting#28736yaooqinn wants to merge 3 commits intoapache:masterfrom yaooqinn:SPARK-31867-F
yaooqinn wants to merge 3 commits intoapache:masterfrom
yaooqinn:SPARK-31867-F
Conversation
|
Test build #123560 has finished for PR 28736 at commit
|
Member
Author
|
cc @cloud-fan @maropu @MaxGekk thanks |
cloud-fan
approved these changes
Jun 5, 2020
|
Test build #123562 has finished for PR 28736 at commit
|
Contributor
|
thanks, merging to master/3.0! |
cloud-fan
pushed a commit
that referenced
this pull request
Jun 5, 2020
…rmatting ### What changes were proposed in this pull request? In this PR, we throw `SparkUpgradeException` when getting `DateTimeException` for datetime formatting in the `EXCEPTION` legacy Time Parser Policy. ### Why are the changes needed? `DateTimeException` is also declared by `java.time.format.DateTimeFormatter#format`, but in Spark, it can barely occur. We have suspected one that due to a JDK bug so far. see https://bugs.openjdk.java.net/browse/JDK-8079628. For `from_unixtime` function, we will suppress the DateTimeException caused by `DD` and result `NULL`. It is a silent date change that should be avoided in Java 8. ### Does this PR introduce _any_ user-facing change? Yes, when running on Java8 and using `from_unixtime` function with pattern `DD` to format datetimes, if dayofyear>=100, `SparkUpgradeException` will alert users instead of silently resulting null. For `date_format`, `SparkUpgradeException` take the palace of `DateTimeException`. ### How was this patch tested? add unit tests. Closes #28736 from yaooqinn/SPARK-31867-F. Authored-by: Kent Yao <yaooqinn@hotmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit fc6af9d) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
gatorsmile
reviewed
Jul 2, 2020
| } catch { | ||
| case _: Throwable => throw e | ||
| } | ||
| throw new SparkUpgradeException("3.0", s"Fail to format it to '$resultCandidate' in the new" + |
Member
There was a problem hiding this comment.
@HyukjinKwon Should we combine the JVM stacktrace for SparkUpgradeException in the python side?
dongjoon-hyun
pushed a commit
that referenced
this pull request
Sep 26, 2023
…erSuite ### What changes were proposed in this pull request? This PR removes the legacy workaround for JDK 8 in #28736. ### Why are the changes needed? - We still need the main code for completeness, and in case there are other diff in the future JDK versions so this PR only fixes the tests. - We dropped JDK 11/8 at SPARK-44112 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Fixed unittests. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #43085 from HyukjinKwon/SPARK-45300. Authored-by: Hyukjin Kwon <gurwls223@apache.org> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
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 this PR, we throw
SparkUpgradeExceptionwhen gettingDateTimeExceptionfor datetime formatting in theEXCEPTIONlegacy Time Parser Policy.Why are the changes needed?
DateTimeExceptionis also declared byjava.time.format.DateTimeFormatter#format, but in Spark, it can barely occur. We have suspected one that due to a JDK bug so far. see https://bugs.openjdk.java.net/browse/JDK-8079628.For
from_unixtimefunction, we will suppress the DateTimeException caused byDDand resultNULL. It is a silent date change that should be avoided in Java 8.Does this PR introduce any user-facing change?
Yes, when running on Java8 and using
from_unixtimefunction with patternDDto format datetimes, if dayofyear>=100,SparkUpgradeExceptionwill alert users instead of silently resulting null. Fordate_format,SparkUpgradeExceptiontake the palace ofDateTimeException.How was this patch tested?
add unit tests.