You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/03/06 20:14:18 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #27807: [SPARK-31076][SQL] Convert Catalyst's DATE/TIMESTAMP to Java Date/Timestamp via local date-time

MaxGekk commented on a change in pull request #27807: [SPARK-31076][SQL] Convert Catalyst's DATE/TIMESTAMP to Java Date/Timestamp via local date-time
URL: https://github.com/apache/spark/pull/27807#discussion_r389121915
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/execution/HiveResultSuite.scala
 ##########
 @@ -23,7 +23,7 @@ class HiveResultSuite extends SharedSparkSession {
   import testImplicits._
 
   test("date formatting in hive result") {
-    val dates = Seq("2018-12-28", "1582-10-13", "1582-10-14", "1582-10-15")
+    val dates = Seq("2018-12-28", "1581-10-13", "1581-10-14", "1581-10-15")
 
 Review comment:
   I had to change the dates because I faced to a strange behavior of JDK 8 when I try to convert a local timestamp in Gregorian calendar to a local timestamp in Julian calendar. Switching from Julian to Gregorian must happen on 1582-10-15 but getCalendarSystem in Date.java considers entire year 1582 as Gregorian one:
   https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/java/util/Date.java#L1277-L1282
   The test works for:
   ```
   1581-10-13 01:02:03
   1583-10-13 01:02:03
   ```
   but not for:
   ```
   1582-10-13 01:02:03
   ```
   Another method of Date works more precisely
   https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/java/util/Date.java#L1284-L1294
   but it is not used in the constructor:
   https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/java/util/Date.java#L253

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org