emecii opened a new pull request, #51272:
URL: https://github.com/apache/arrow/pull/51272

   ### Rationale for this change
   
   `ArrowFormat::Date32Array` currently stores `Date#day`, the day of the 
month, for Ruby `Date` values. Arrow Date32 values are signed day offsets from 
the Unix epoch, so this can silently produce incorrect data. The same 
conversion is used by `ArrowFormat::Array.build` when it infers Date32.
   
   ### What changes are included in this PR?
   
   * Convert Ruby `Date` values from their Julian day to the Unix epoch day 
offset.
   * Cover dates before, at, and after the Unix epoch, including nulls.
   * Make the ArrayBuilder regression assert the encoded payload instead of 
comparing two arrays built through the same conversion path.
   
   ### Are these changes tested?
   
   Yes. The full `red-arrow-format` suite passes locally: 691 tests and 695 
assertions. The official rake runner used the current pure-Ruby sources with 
the locally installed Arrow 25.0.1 native extension; the local system does not 
have the Arrow C++ 26 dependency needed to build the native Ruby extension from 
`main`.
   
   ### Are there any user-facing changes?
   
   Yes. Ruby `Date` values now produce specification-compliant Date32 day 
offsets.
   
   **This PR contains a "Critical Fix".** It fixes incorrect Date32 data 
produced from Ruby `Date` values.
   
   ### AI assistance
   
   AI assistance was used to investigate the defect, draft the focused 
implementation and tests, and run the verification described above. No human 
review is claimed.
   
   * GitHub Issue: #51271


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

Reply via email to