-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-36970][SQL] Manual disabled format B of date_format function to make Java 17 compatible with Java 8
#34237
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
Conversation
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
| // 2.4, the SimpleDateFormat uses Monday as the first day of week. | ||
| final val weekBasedLetters = Set('Y', 'W', 'w', 'u', 'e', 'c') | ||
| final val unsupportedLetters = Set('A', 'n', 'N', 'p') | ||
| final val unknownPatternLetters: Set[Char] = Set('B') |
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.
What's the difference between unsupported and unknown letters from your point of view?
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.
@MaxGekk Both unsupportedLetters and unknownPatternLetters are used for explicitly banned some pattern letters and throw IllegalArgumentException
The only difference is the content of the error message, throw IllegalArgumentException with Unknown pattern letter: $c Is the current behavior.
spark/sql/core/src/test/resources/sql-tests/results/datetime-formatting-invalid.sql.out
Lines 311 to 317 in 32e11ea
| -- !query | |
| select date_format('2018-11-17 13:33:33.333', 'B') | |
| -- !query schema | |
| struct<> | |
| -- !query output | |
| java.lang.IllegalArgumentException | |
| Unknown pattern letter: B |
If we accept the change of error message content, we can reuse unsupportedLetters.
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 accept the change of error message content ...
I think it is ok. Let's put 'B' to unsupportedLetters. BTW, should we standardise the exception by following https://issues.apache.org/jira/browse/SPARK-33539, cc @allisonwang-db ?
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 ~
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.
Awesome thanks!
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #144066 has finished for PR 34237 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #144072 has finished for PR 34237 at commit
|
|
Test build #144078 has finished for PR 34237 at commit
|
dongjoon-hyun
left a comment
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.
+1, LGTM. Thank you, @LuciferYang , @srowen , @MaxGekk .
Merged to master for Apache Spark 3.3.
|
Oh, I'm taking my words back. It seems that there is a TPCDS test failure still. |
|
Could you re-trigger GitHub Action once more, @LuciferYang ? |
OK, the exit code is 137. It looks like it was killed |
|
@dongjoon-hyun |
|
@LuciferYang Could you re-trigger GAs via an empty commit: |
|
Test build #144143 has finished for PR 34237 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test starting |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test status failure |
|
Already re-trigger GAs many times,it seems that I need to investigate the reasons for the failure of hive SlowTest |
|
Test build #144152 has finished for PR 34237 at commit
|
|
+1, LGTM. Merging to master. All GAs passed |
|
Thank you all. :) |
|
thank all ~ |


What changes were proposed in this pull request?
The
date_formatfunction withBformat has different behavior when use Java 8 and Java 17,select date_format('2018-11-17 13:33:33.333', 'B')indatetime-formatting-invalid.sqlcan prove this.The case result with Java 8 is
and the case result with Java 17 is
We found that this is due to the new support of format
Bin Java 17And through http://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html , we can confirm that format
Bis not documented/supported fordate_formatfunction currently.So the main change of this pr is manual disabled format
Bofdate_formatfunction inDateTimeFormatterHelperto make Java 17 compatible with Java 8.Why are the changes needed?
Ensure that Java 17 and Java 8 have the same behavior.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
SQLQueryTestSuitewith JDK 17Before
After
The test
select date_format('2018-11-17 13:33:33.333', 'B')indatetime-formatting-invalid.sqlpassed