Skip to content

Conversation

@yaooqinn
Copy link
Member

@yaooqinn yaooqinn commented Jun 5, 2020

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.

@yaooqinn yaooqinn marked this pull request as draft June 5, 2020 10:40
@SparkQA
Copy link

SparkQA commented Jun 5, 2020

Test build #123560 has finished for PR 28736 at commit a8f7131.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yaooqinn yaooqinn marked this pull request as ready for review June 5, 2020 12:06
@yaooqinn
Copy link
Member Author

yaooqinn commented Jun 5, 2020

cc @cloud-fan @maropu @MaxGekk thanks

@SparkQA
Copy link

SparkQA commented Jun 5, 2020

Test build #123562 has finished for PR 28736 at commit 54e70b6.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@cloud-fan
Copy link
Contributor

thanks, merging to master/3.0!

@cloud-fan cloud-fan closed this in fc6af9d Jun 5, 2020
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 <[email protected]>
Signed-off-by: Wenchen Fan <[email protected]>
(cherry picked from commit fc6af9d)
Signed-off-by: Wenchen Fan <[email protected]>
} catch {
case _: Throwable => throw e
}
throw new SparkUpgradeException("3.0", s"Fail to format it to '$resultCandidate' in the new" +
Copy link
Member

@gatorsmile gatorsmile Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HyukjinKwon Should we combine the JVM stacktrace for SparkUpgradeException in the python side?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1!

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 <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants