mrbuho-O opened a new pull request, #55823:
URL: https://github.com/apache/arrow/pull/55823

   ### Rationale for this change
   
   An R `Date` can contain infinity or NaN. On Windows with Arrow 26.0.1.1, 
converting any of those values to a table, or writing and reading it through 
Feather or Parquet, produced a date 2,147,483,648 days before the epoch. A date 
comparison can then return the wrong answer.
   
   ### What changes are included in this PR?
   
   Check that the day or millisecond count fits the signed storage type before 
casting it. R's `NA` still produces an Arrow null. NaN, either infinity and 
finite dates outside the storage range raise a conversion error. This preserves 
the R binding's distinction between `NA` and NaN.
   
   ### Are these changes tested?
   
   Yes. The regression covers both Arrow date types, ordinary dates on either 
side of the epoch, missing dates, NaN, both infinities and storage limits. I 
built the patched R package on Windows with R 4.6.2. The Array test file passed 
1,189 expectations with 10 skips. I also verified the table, Feather V2 and 
Parquet examples before and after the change.
   
   ### Are there any user-facing changes?
   
   **This PR contains a Critical Fix.** Previously, converting an 
unrepresentable R date could write a finite date into the output. Conversion 
now reports the value and target type.
   
   ### Was AI used for this PR?
   
   OpenAI Codex wrote the code, regression tests and PR description. Codex also 
reviewed the change and ran the tests.
   
   **PR code and description written by**
   
   - [ ] Human
   - [x] AI
   
   **Reviewed before submission by**
   
   - [ ] Human
   - [x] AI
   - [ ] Not reviewed
   
   Closes #49836.


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