viirya commented on a change in pull request #23000: [SPARK-26002][SQL] Fix day 
of year calculation for Julian calendar days
URL: https://github.com/apache/spark/pull/23000#discussion_r242411040
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/DateTimeUtils.scala
 ##########
 @@ -53,14 +53,27 @@ object DateTimeUtils {
 
   final val MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L
 
-  // number of days in 400 years
+  // number of days in 400 years by Gregorian calendar
   final val daysIn400Years: Int = 146097
+
+  // In Julian calendar every year which is a multiple of 4 is a leap year.
+  // So in 400 years there are 3 extra leap years compared to the Gregorian 
calendar:
+  // 100, 200 and 300 (as multiples of 100 but not 400).
 
 Review comment:
   Actually I must read 
https://en.wikipedia.org/wiki/Julian_calendar#Year_length;_leap_years to 
understand why there are three extra days here. I'm not sure if this added 
comments are enough clear to others.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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