-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-36970][SQL] Manual disabled format B
of date_format
function to make Java 17 compatible with Java 8
#34237
Conversation
Kubernetes integration test starting |
Kubernetes integration test status failure |
@@ -280,6 +280,7 @@ private object DateTimeFormatterHelper { | |||
// 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
|
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_format
function withB
format has different behavior when use Java 8 and Java 17,select date_format('2018-11-17 13:33:33.333', 'B')
indatetime-formatting-invalid.sql
can 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
B
in Java 17And through http://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html , we can confirm that format
B
is not documented/supported fordate_format
function currently.So the main change of this pr is manual disabled format
B
ofdate_format
function inDateTimeFormatterHelper
to 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?
SQLQueryTestSuite
with JDK 17Before
After
The test
select date_format('2018-11-17 13:33:33.333', 'B')
indatetime-formatting-invalid.sql
passed