Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-15834 Time zone / locale sensitivity umbrella
  3. SPARK-15723

SimpleDateParamSuite test is locale-fragile and relies on deprecated short TZ name


    • Type: Sub-task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.6.1
    • Fix Version/s: 1.6.2, 2.0.0
    • Component/s: Spark Core
    • Labels:


      org.apache.spark.status.api.v1.SimpleDateParamSuite has this assertion:

          new SimpleDateParam("2015-02-20T17:21:17.190EST").timestamp should be (1424470877190L)

      This test is fragile and fails when executing in an environment where the local default timezone causes EST to be interpreted as something other than US Eastern Standard Time. If your local timezone is Australia/Sydney, then EST equates to GMT+10 and you will get:

      date parsing *** FAILED ***
      1424413277190 was not equal to 1424470877190 (SimpleDateParamSuite.scala:29)

      In short, SimpleDateFormat is sensitive to the local default TimeZone when interpreting short zone names. According to the TimeZone javadoc, they ought not be used:

      Three-letter time zone IDs

      For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported. However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them.




            • Assignee:
              brett_s_r Brett Randall
              brett_s_r Brett Randall
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: