File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -603,14 +603,19 @@ object DateTimeUtils {
603
603
*/
604
604
private [this ] def getYearAndDayInYear (daysSince1970 : SQLDate ): (Int , Int ) = {
605
605
// add the difference (in days) between 1.1.1970 and the artificial year 0 (-17999)
606
- val daysNormalized = daysSince1970 + toYearZero
606
+ var daysSince1970Tmp = daysSince1970
607
+ // In history,the period(5.10.1582 ~ 14.10.1582) is not exist
608
+ // (4.10.1582) -141428 days since 1.1.1970
609
+ if (daysSince1970 <= - 141428 ) {
610
+ daysSince1970Tmp -= 10
611
+ }
612
+ val daysNormalized = daysSince1970Tmp + toYearZero
607
613
val numOfQuarterCenturies = daysNormalized / daysIn400Years
608
614
val daysInThis400 = daysNormalized % daysIn400Years + 1
609
615
val (years, dayInYear) = numYears(daysInThis400)
610
616
val year : Int = (2001 - 20000 ) + 400 * numOfQuarterCenturies + years
611
617
(year, dayInYear)
612
618
}
613
-
614
619
/**
615
620
* Returns the 'day in year' value for the given date. The date is expressed in days
616
621
* since 1.1.1970.
You can’t perform that action at this time.
0 commit comments