MaxGekk opened a new pull request #28225: [SPARK-31423][SQL] Fix rebasing of 
not-existed dates
URL: https://github.com/apache/spark/pull/28225
 
 
   ### What changes were proposed in this pull request?
   In the PR, I propose to change rebasing of not-existed dates in the hybrid 
calendar (Julian + Gregorian since 1582-10-15) in the range (1582-10-04, 
1582-10-15). Not existed dates from the range are shifted to the first valid 
date in the hybrid calendar - 1582-10-15. The changes affect only 
`rebaseGregorianToJulianDays()` because reverse rebasing from the hybrid dates 
to Proleptic Gregorian dates does not have such problem.
   
   ### Why are the changes needed?
   Currently, not-existed dates are shifted by standard difference between 
Julian and Gregorian calendar on 1582-10-04, for example 1582-10-14 -> 
1582-10-24. That's contradict to shifting not existed dates in other cases, for 
example:
   ```
   scala> sql("select date'1990-9-31'").show
   +-----------------+
   |DATE '1990-10-01'|
   +-----------------+
   |       1990-10-01|
   +-----------------+
   ```
   
   ### Does this PR introduce any user-facing change?
   Yes, this impacts on conversion of Spark SQL `DATE` values to external dates 
based on non-Proleptic Gregorian calendar. For example, while saving the 
1582-10-14 date to ORC files, it will be shifted to the next valid date 
1582-10-15.
   
   ### How was this patch tested?
   - Added tests to `RebaseDateTimeSuite` and to `OrcSourceSuite`
   - By existing test suites `DateTimeUtilsSuite`, `DateFunctionsSuite`, 
`DateExpressionsSuite`, `CollectionExpressionsSuite`, `ParquetIOSuite`.

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


With regards,
Apache Git Services

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

Reply via email to