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/05/03 21:34:14 UTC

[GitHub] [spark] MaxGekk commented on a change in pull request #28443: [SPARK-31212][SQL][WIP] Fix Failure of casting the '1000-02-29' string to the date type

MaxGekk commented on a change in pull request #28443:
URL: https://github.com/apache/spark/pull/28443#discussion_r419162505



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
##########
@@ -205,6 +205,29 @@ object DateTimeUtils {
     (day.toInt, MICROSECONDS.toNanos(micros))
   }
 
+  /**
+   *Returns Gregorian days since epoch
+   */
+  def toGregorianDays(
+      year: Int,
+      month: Byte = 1,
+      day: Byte = 1,
+      hour: Byte = 0,
+      minute: Byte = 0,
+      sec: Byte = 0): SQLDate = {
+    val calendar = new GregorianCalendar(year, month - 1, day, hour, minute, sec)

Review comment:
       it is not pure Gregorian  calendar. For 1000-02-29, it is Julian calendar.




----------------------------------------------------------------
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



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