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



##########
File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateFormatter.scala
##########
@@ -66,7 +66,8 @@ trait LegacyDateFormatter extends DateFormatter {
   def formatDate(d: Date): String
 
   override def parse(s: String): Int = {
-    val micros = DateTimeUtils.millisToMicros(parseToDate(s).getTime)
+    val julianMicros = DateTimeUtils.millisToMicros(parseToDate(s).getTime)
+    val micros = RebaseDateTime.rebaseJulianToGregorianMicros(julianMicros)
     DateTimeUtils.microsToDays(micros)

Review comment:
       An alternative approach is to use fromJavaDate:
   ```scala
   fromJavaDate(new java.sql.Date(parseToDate(s).getTime))
   ```
   I would guess, it is faster. 




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



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

Reply via email to