Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import org.apache.spark.sql.catalyst.util.DateTimeConstants._
import org.apache.spark.sql.catalyst.util.DateTimeTestUtils._
import org.apache.spark.sql.catalyst.util.DateTimeUtils._
import org.apache.spark.sql.catalyst.util.RebaseDateTime._
import org.apache.spark.util.ThreadUtils

class RebaseDateTimeSuite extends SparkFunSuite with Matchers with SQLHelper {

Expand Down Expand Up @@ -254,11 +255,7 @@ class RebaseDateTimeSuite extends SparkFunSuite with Matchers with SQLHelper {
import com.fasterxml.jackson.module.scala.{DefaultScalaModule, ScalaObjectMapper}

case class RebaseRecord(tz: String, switches: Array[Long], diffs: Array[Long])

val result = new ArrayBuffer[RebaseRecord]()
ALL_TIMEZONES
.sortBy(_.getId)
.foreach { zid =>
val rebaseRecords = ThreadUtils.parmap(ALL_TIMEZONES, "JSON-rebase-gen", 16) { zid =>
withDefaultTimeZone(zid) {
val tz = TimeZone.getTimeZone(zid)
val start = adjustFunc(
Expand All @@ -272,7 +269,7 @@ class RebaseDateTimeSuite extends SparkFunSuite with Matchers with SQLHelper {

var micros = start
var diff = Long.MaxValue
val maxStep = DAYS_PER_WEEK * MICROS_PER_DAY
val maxStep = 30 * MICROS_PER_MINUTE
var step: Long = MICROS_PER_SECOND
val switches = new ArrayBuffer[Long]()
val diffs = new ArrayBuffer[Long]()
Expand All @@ -294,9 +291,11 @@ class RebaseDateTimeSuite extends SparkFunSuite with Matchers with SQLHelper {
}
micros += step
}
result.append(RebaseRecord(zid.getId, switches.toArray, diffs.toArray))
RebaseRecord(zid.getId, switches.toArray, diffs.toArray)
}
}
val result = new ArrayBuffer[RebaseRecord]()
rebaseRecords.sortBy(_.tz).foreach(result.append(_))
val mapper = (new ObjectMapper() with ScalaObjectMapper)
.registerModule(DefaultScalaModule)
.writerWithDefaultPrettyPrinter()
Expand Down