Repository navigation
Conversation
|
Thanks for opening a pull request! This pull request has been automatically closed because you currently have 4 open pull requests, which is more than the limit of 3. Due to the increase in pull requests opened by AI bots, and in order to keep the review queue manageable, Apache Arrow limits contributors without repository access to at most 3 concurrently open pull requests. This helps make sure each pull request gets the attention it needs and that work in progress does not go stale. Once one of your other open pull requests has been merged or closed, you are welcome to reopen this one. See also: |
|
|
|
Could you rebase on main? |
… CSV date columns Columns explicitly typed as date32 or date64 were parsed only from the ISO-8601 format. Try ConvertOptions::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. Strptime parsers without a date directive are skipped, so that a time is not accepted with a default date. Type inference of date columns is not affected. Drafted by Claude Code (an AI agent) and reviewed & approved by pearu.
21d8ef4 to
6b1fcda
Compare
Done. Please review. |
kou
left a comment
There was a problem hiding this comment.
If we have a separated date_parsers, can we simplify the current implementation?
|
I used an AI agent to analyze the suggested alternative for its pros and cons. Assuming the existing tests stay as representative samples of the feature, with a separate Could go:
Would come:
Everything else would stay, as the tests use datetime formats, The API change is the more important point: a new public option that is documented and kept from then on. So the implementation would get somewhat simpler, at the cost of a larger API. On this balance I'd keep the current approach, unless you see an API reason for the separate option. |
Rationale for this change
CSV columns typed as
date32ordate64are parsed only from the ISO-8601 format, andConvertOptions::timestamp_parsersapplies only to timestamp columns, so other date formats need reading as a timestamp and a cast.What changes are included in this PR?
timestamp_parsersafter 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 ofdate32/date64are rejected.strptimeparsers without a date directive are skipped, so that e.g."%H:%M:%S"does not turn a time into 1900-01-01.timestamp_parsers, fractional seconds are accepted and discarded.This PR is the date part of #50146.
Are these changes tested?
Yes,
Date32Conversion.UserDefinedParsersandDate64Conversion.UserDefinedParsersin C++, andtest_dates_with_timestamp_parsersin Python.Are there any user-facing changes?
Yes,
timestamp_parsersnow also applies todate32/date64columns given incolumn_types. This is documented in the C++ CSV docs and theConvertOptionsdocstring.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.