-
Notifications
You must be signed in to change notification settings - Fork 29.1k
[SPARK-31277][SQL][TESTS] Migrate DateTimeTestUtils from TimeZone to ZoneId
#28033
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
|
Test build #120414 has finished for PR 28033 at commit
|
|
jenkins, retest this, please |
DateTimeTestUtils from TimeZone to ZoneIdDateTimeTestUtils from TimeZone to ZoneId
|
@cloud-fan @HyukjinKwon Please, have a look at the PR. |
|
Test build #120433 has finished for PR 28033 at commit
|
|
|
||
| val tz = LA.getId | ||
| withDefaultTimeZone(TimeZone.getTimeZone(tz)) { | ||
| withDefaultTimeZone(getZoneId(tz)) { |
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.
nit: just LA?
| val UTC_OPT = Option("UTC") | ||
|
|
||
| val ALL_TIMEZONES: Seq[TimeZone] = TimeZone.getAvailableIDs.toSeq.map(TimeZone.getTimeZone) | ||
| val ALL_TIMEZONES: Seq[ZoneId] = ZoneId.getAvailableZoneIds.asScala.map(getZoneId).toSeq |
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.
I'm wondering if we should only test the outstandingZoneIds instead of ALL_TIMEZONES. The test can be very slow if we test all timezones.
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.
We already discussed this some time ago, see #22657 . We replaced ALL_TIMEZONES by outstanding time zones in some places but decided to leave in date-time tests. @srowen proposed to run tests for ALL_TIMEZONES in parallel, see #22672 (#22672 (comment)). Total time of testing all time zone in parallel ~0.24 seconds. Not so much, I think.
|
Test build #120453 has finished for PR 28033 at commit
|
|
jenkins, retest this, please |
|
Test build #120464 has finished for PR 28033 at commit
|
|
thanks, merging to master/3.0 ! |
… to `ZoneId` In the PR, I propose to change types of `DateTimeTestUtils` values and functions by replacing `java.util.TimeZone` to `java.time.ZoneId`. In particular: 1. Type of `ALL_TIMEZONES` is changed to `Seq[ZoneId]`. 2. Remove `val outstandingTimezones: Seq[TimeZone]`. 3. Change the type of the time zone parameter in `withDefaultTimeZone` to `ZoneId`. 4. Modify affected test suites. Currently, Spark SQL's date-time expressions and functions have been already ported on Java 8 time API but tests still use old time APIs. In particular, `DateTimeTestUtils` exposes functions that accept only TimeZone instances. This is inconvenient, and CPU consuming because need to convert TimeZone instances to ZoneId instances via strings (zone ids). No By affected test suites executed by jenkins builds. Closes #28033 from MaxGekk/with-default-time-zone. Authored-by: Maxim Gekk <max.gekk@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> (cherry picked from commit 9f0c010) Signed-off-by: Wenchen Fan <wenchen@databricks.com>
… to `ZoneId` ### What changes were proposed in this pull request? In the PR, I propose to change types of `DateTimeTestUtils` values and functions by replacing `java.util.TimeZone` to `java.time.ZoneId`. In particular: 1. Type of `ALL_TIMEZONES` is changed to `Seq[ZoneId]`. 2. Remove `val outstandingTimezones: Seq[TimeZone]`. 3. Change the type of the time zone parameter in `withDefaultTimeZone` to `ZoneId`. 4. Modify affected test suites. ### Why are the changes needed? Currently, Spark SQL's date-time expressions and functions have been already ported on Java 8 time API but tests still use old time APIs. In particular, `DateTimeTestUtils` exposes functions that accept only TimeZone instances. This is inconvenient, and CPU consuming because need to convert TimeZone instances to ZoneId instances via strings (zone ids). ### Does this PR introduce any user-facing change? No ### How was this patch tested? By affected test suites executed by jenkins builds. Closes apache#28033 from MaxGekk/with-default-time-zone. Authored-by: Maxim Gekk <max.gekk@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
In the PR, I propose to change types of
DateTimeTestUtilsvalues and functions by replacingjava.util.TimeZonetojava.time.ZoneId. In particular:ALL_TIMEZONESis changed toSeq[ZoneId].val outstandingTimezones: Seq[TimeZone].withDefaultTimeZonetoZoneId.Why are the changes needed?
Currently, Spark SQL's date-time expressions and functions have been already ported on Java 8 time API but tests still use old time APIs. In particular,
DateTimeTestUtilsexposes functions that accept only TimeZone instances. This is inconvenient, and CPU consuming because need to convert TimeZone instances to ZoneId instances via strings (zone ids).Does this PR introduce any user-facing change?
No
How was this patch tested?
By affected test suites executed by jenkins builds.