Skip to content

Commit c5b8d54

Browse files
d80tb7srowen
authored andcommitted
[SPARK-24950][SQL] DateTimeUtilsSuite daysToMillis and millisToDays fails w/java 8 181-b13
## What changes were proposed in this pull request? - Update DateTimeUtilsSuite so that when testing roundtripping in daysToMillis and millisToDays multiple skipdates can be specified. - Updated test so that both new years eve 2014 and new years day 2015 are skipped for kiribati time zones. This is necessary as java versions pre 181-b13 considered new years day 2015 to be skipped while susequent versions corrected this to new years eve. ## How was this patch tested? Unit tests Author: Chris Martin <[email protected]> Closes apache#21901 from d80tb7/SPARK-24950_datetimeUtilsSuite_failures.
1 parent c6a3db2 commit c5b8d54

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -662,18 +662,18 @@ class DateTimeUtilsSuite extends SparkFunSuite {
662662
assert(daysToMillis(16800, TimeZoneGMT) === c.getTimeInMillis)
663663

664664
// There are some days are skipped entirely in some timezone, skip them here.
665-
val skipped_days = Map[String, Int](
666-
"Kwajalein" -> 8632,
667-
"Pacific/Apia" -> 15338,
668-
"Pacific/Enderbury" -> 9131,
669-
"Pacific/Fakaofo" -> 15338,
670-
"Pacific/Kiritimati" -> 9131,
671-
"Pacific/Kwajalein" -> 8632,
672-
"MIT" -> 15338)
665+
val skipped_days = Map[String, Set[Int]](
666+
"Kwajalein" -> Set(8632),
667+
"Pacific/Apia" -> Set(15338),
668+
"Pacific/Enderbury" -> Set(9130, 9131),
669+
"Pacific/Fakaofo" -> Set(15338),
670+
"Pacific/Kiritimati" -> Set(9130, 9131),
671+
"Pacific/Kwajalein" -> Set(8632),
672+
"MIT" -> Set(15338))
673673
for (tz <- DateTimeTestUtils.ALL_TIMEZONES) {
674-
val skipped = skipped_days.getOrElse(tz.getID, Int.MinValue)
674+
val skipped = skipped_days.getOrElse(tz.getID, Set.empty)
675675
(-20000 to 20000).foreach { d =>
676-
if (d != skipped) {
676+
if (!skipped.contains(d)) {
677677
assert(millisToDays(daysToMillis(d, tz), tz) === d,
678678
s"Round trip of ${d} did not work in tz ${tz}")
679679
}

0 commit comments

Comments
 (0)