ted-jenks opened a new pull request, #7530:
URL: https://github.com/apache/datafusion-comet/pull/7530

   ## Which issue does this PR close?
   
   Closes #6997.
   
   ## Rationale for this change
   
   The same calendar conversion was written out seven times across spark-expr 
and core, and the copies had already drifted in how they floor and index 
months. DataFusion has the same pair in date_trunc.rs but keeps it private, and 
chrono stops at year 262142, so one shared copy in native/common is the 
simplest fix.
   
   ## What changes are included in this PR?
   
   `days_from_civil` and `civil_from_days` now live in 
`native/common/src/calendar.rs` and every caller uses them directly. The old 
copies differed only in form, flooring with `(y - 399) / 400` in string.rs and 
`shifted - 146_096` in the partition path, and indexing months with `(m + 9) % 
12` in the Parquet rebase, and each matches the `div_euclid` version for every 
input its callers pass. The test helper in string.rs stays on purpose as an 
independent oracle for the ported Spark tests. There is one commit per call 
site.
   
   ## How are these changes tested?
   
   New tests in calendar.rs walk four 400 year eras day by day and check that 
every era repeats out to the i32 day range. The existing string, Iceberg and 
Parquet rebase tests pass unchanged.
   


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

To unsubscribe, e-mail: [email protected]

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