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

   ### Rationale for this change
   
   CSV columns typed as `date32` or `date64` are parsed only from the ISO-8601 
format, and `ConvertOptions::timestamp_parsers` applies only to timestamp 
columns, so other date formats need reading as a timestamp and a cast.
   
   ### What changes are included in this PR?
   
   - Date columns try `timestamp_parsers` after the ISO-8601 parser fails, and 
floor the parsed timestamp to the day boundary, as a cast from timestamp to 
date does. Values outside the range of `date32`/`date64` are rejected.
   - `strptime` parsers without a date directive are skipped, so that e.g. 
`"%H:%M:%S"` does not turn a time into 1900-01-01.
   - With the ISO-8601 parser in `timestamp_parsers`, fractional seconds are 
accepted and discarded.
   - Type inference of date columns is unchanged and uses ISO-8601 only, so a 
value with a time of day is not inferred as a date.
   
   This PR is the date part of #50146. It builds on #54656, #54657 and #54659, 
whose fixes its tests cover for date columns, and those must land first. Only 
the last commit is new here.
   
   ### Are these changes tested?
   
   Yes, `Date32Conversion.UserDefinedParsers` and 
`Date64Conversion.UserDefinedParsers` in C++, and 
`test_dates_with_timestamp_parsers` in Python.
   
   ### Are there any user-facing changes?
   
   Yes, `timestamp_parsers` now also applies to `date32`/`date64` columns given 
in `column_types`. This is documented in the C++ CSV docs and the 
`ConvertOptions` docstring.
   
   ### AI usage disclosure
   
   Developed with AI assistance (Claude Code): the implementation, tests, 
documentation and this description were AI-generated under my direction and 
reviewed line by line by me. I own and can debug these changes. No copyrighted 
material is included.
   
   * GitHub Issue: #54650
   


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