-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-31892][SQL][FOLLOWUP][test-java11] Improve test coverage for datetime pattern with formatter functions #28718
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
-- !query schema | ||
struct<date_format(t, VV z zz zzz zzzz O OOOO X XX XXX XXXX XXXXX x xx xxx xxxx xxxx xxxxx Z ZZ ZZZ ZZZZ ZZZZZ):string> | ||
-- !query output | ||
America/Los_Angeles PST PST PST Pacific Standard Time GMT-7:52:58 GMT-07:52:58 -0752 -0752 -07:52 -075258 -07:52:58 -0752 -0752 -07:52 -075258 -075258 -07:52:58 -0752 -0752 -0752 GMT-07:52:58 -07:52:58 |
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.
Do you know what causes this inaccuracy for dates before 1582-10-15?@cloud-fan
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.
cc @MaxGekk
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.
It seems to only display the value of spark.sql.session.timeZone
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.
actually, this is expected. The Spark test uses timezone America/Los_Angeles
, which is indeed GMT-7:52:58 long time before, see https://www.politico.com/story/2017/11/18/railroads-initiative-synchronizes-us-clocks-nov-18-1883-244935
Spark's timestamp value doesn't have an associated timezone, so extracting timezone means showing the session local timezone.
...atalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala
Outdated
Show resolved
Hide resolved
sql/core/src/test/resources/sql-tests/results/datetime-legacy.sql.out
Outdated
Show resolved
Hide resolved
...atalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeFormatterHelperSuite.scala
Show resolved
Hide resolved
sql/core/src/test/resources/sql-tests/inputs/datetime-formatting.sql
Outdated
Show resolved
Hide resolved
Test build #123479 has finished for PR 28718 at commit
|
Test build #123476 has finished for PR 28718 at commit
|
Test build #123487 has finished for PR 28718 at commit
|
Test build #123480 has finished for PR 28718 at commit
|
Test build #123482 has finished for PR 28718 at commit
|
Test build #123490 has finished for PR 28718 at commit
|
sql/core/src/test/resources/sql-tests/inputs/datetime-formatting-invalid.sql
Outdated
Show resolved
Hide resolved
sql/core/src/test/resources/sql-tests/inputs/datetime-formatting-invalid.sql
Outdated
Show resolved
Hide resolved
Test build #123486 has finished for PR 28718 at commit
|
@@ -0,0 +1,36 @@ | |||
--- TESTS FOR DATETIME FORMATTING FUNCTIONS WITH INVALID PATTERNS --- | |||
|
|||
-- separating this from datetime-formatting.sql ,because the text form |
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.
.sql ,because
-> .sql, because
select date_format('2018-11-17 13:33:33.333', 'EEEEE'); | ||
select date_format('2018-11-17 13:33:33.333', 'FF'); | ||
select date_format('2018-11-17 13:33:33.333', 'ddd'); | ||
-- DD is invalid in 8, but valid in 11 for the JDKs that PR builder uses |
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.
DD is invalid if the day-of-year exceeds 100, but it becomes valid in Java 11.
|
||
select col, date_format(col, 'S SS SSS SSSS SSSSS SSSSSS SSSSSSS SSSSSSSS SSSSSSSSS') from v; | ||
|
||
-- add upper function here to avoid |
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.
to avoid what?
@dongjoon-hyun do you know how to trigger java 11 test in the PR builder? |
@cloud-fan See the example #28463 - add |
retest this please |
Sorry for being late. Yes, @MaxGekk 's comment is correct. |
Test build #123488 has finished for PR 28718 at commit
|
Test build #123491 has finished for PR 28718 at commit
|
Test build #123498 has finished for PR 28718 at commit
|
Test build #123494 has finished for PR 28718 at commit
|
Test build #123493 has finished for PR 28718 at commit
|
What changes were proposed in this pull request?
This PR is a followup for #28706, we want fully check for the formatter, which can warn us ahead if there is any behavior change when we update JDK.
Why are the changes needed?
test coverage and hotfix for the silly mistake in #28706 at https://github.com/apache/spark/pull/28718/files#diff-7f589e01d3e5e5ea284c1622527d4984R49
Does this PR introduce any user-facing change?
NO
How was this patch tested?
add tests