Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -23,7 +23,7 @@ import org.apache.spark.SparkFunSuite
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.errors.TreeNodeException
import org.apache.spark.sql.catalyst.plans.PlanTestBase
import org.apache.spark.sql.catalyst.util.{ArrayBasedMapData, DateTimeTestUtils, DateTimeUtils, GenericArrayData, PermissiveMode}
import org.apache.spark.sql.catalyst.util._
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.UTF8String
Expand Down Expand Up @@ -510,7 +510,7 @@ class JsonExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper with
)

val jsonData2 = """{"t": "2016-01-01T00:00:00"}"""
for (tz <- DateTimeTestUtils.ALL_TIMEZONES) {
for (tz <- DateTimeTestUtils.TIMEZONES) {
c = Calendar.getInstance(tz)
c.set(2016, 0, 1, 0, 0, 0)
c.set(Calendar.MILLISECOND, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ object DateTimeTestUtils {

val ALL_TIMEZONES: Seq[TimeZone] = TimeZone.getAvailableIDs.toSeq.map(TimeZone.getTimeZone)

val TIMEZONES = Seq(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we move it to SparkFunSuite and name it like outstandingTimezones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it should be useful across a few test suites. I will do that.

TimeZone.getTimeZone("UTC"),
TimeZone.getTimeZone("PST"),
TimeZone.getTimeZone("CET"),
TimeZone.getTimeZone("Africa/Dakar"),
TimeZone.getTimeZone("America/Los_Angeles"),
TimeZone.getTimeZone("Antarctica/Vostok"),
TimeZone.getTimeZone("Asia/Hong_Kong"),
TimeZone.getTimeZone("Europe/Amsterdam"))

def withDefaultTimeZone[T](newDefaultTimeZone: TimeZone)(block: => T): T = {
val originalDefaultTimeZone = TimeZone.getDefault
try {
Expand Down