MaxGekk commented on a change in pull request #27980: [SPARK-31221][SQL] Rebase 
any date-times in conversions to/from Java types
URL: https://github.com/apache/spark/pull/27980#discussion_r396287278
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/util/DateTimeUtilsSuite.scala
 ##########
 @@ -508,8 +504,8 @@ class DateTimeUtilsSuite extends SparkFunSuite with 
Matchers with SQLHelper {
       test("2016-03-13 03:00:00", "PST", "2016-03-13 10:00:00.0")
       test("2016-11-06 00:59:59", "PST", "2016-11-06 07:59:59.0")
       // 2016-11-06 01:00:00 PST could be 2016-11-06 08:00:00 UTC or 
2016-11-06 09:00:00 UTC
-      test("2016-11-06 01:00:00", "PST", "2016-11-06 09:00:00.0")
-      test("2016-11-06 01:59:59", "PST", "2016-11-06 09:59:59.0")
+      test("2016-11-06 01:00:00", "PST", "2016-11-06 08:00:00.0")
 
 Review comment:
   Probably, I have found the reason this behavior. While resolving **PST** to 
zone offsets, this short name is converted to **America/Los_Angeles** by the 
map:
   
https://github.com/frohoff/jdk8u-jdk/blob/master/src/share/classes/java/time/ZoneId.java#L248
   And as a consequence, `PST` is not a constant offset:
   ```scala
      val pst = getZoneId("PST")
       println(pst.getRules.getOffset(LocalDateTime.of(2016, 11, 5, 23, 59, 
59)))
       println(pst.getRules.getOffset(LocalDateTime.of(2016, 11, 6, 0, 0, 0)))
       println(pst.getRules.getOffset(LocalDateTime.of(2016, 11, 6, 1, 0, 0)))
       println(pst.getRules.getOffset(LocalDateTime.of(2016, 11, 6, 2, 0, 0)))
       println(pst.getRules.getOffset(LocalDateTime.of(2016, 11, 6, 3, 0, 0)))
   ```
   ```
   -07:00
   -07:00
   -07:00
   -08:00
   -08:00
   ```
   At the test local timestamp `2016-11-06 01:00:00`, the offset is `-07:00`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to