ax1s-x1zz opened a new pull request, #11006:
URL: https://github.com/apache/arrow-rs/pull/11006

   ## What does this PR do?
   
   PostgreSQL interprets an interval unit with no preceding amount as an amount 
of zero — `'5 day hour'` is the same as `'5 day 0 hour'`. 
`parse_interval_month_day_nano_config` (and friends) instead rejected such 
strings, because the empty amount failed to parse.
   
   This is the gap behind the DataFusion case `SELECT interval '5 day' hour` 
(which becomes the interval string `"5 day HOUR"`), see 
https://github.com/apache/datafusion/issues/12448.
   
   ## Changes
   
   In `parse_interval_components` (arrow-cast/src/parse.rs), an empty amount 
string is now treated as a zero `IntervalAmount`:
   
   - `"5 day hour"` → `5 days` (like `"5 day 0 hour"`)
   - Case-insensitive units already work, so `"5 day HOUR"` also parses
   - A bare unit alone, e.g. `"hour"`, is zero
   - Unknown units and repeated units still error
   
   One existing test changed: `"1h s"` previously errored and now parses as `1 
hour` (the bare `s` contributes zero). This is the intended permissiveness 
change from #6390.
   
   ## Checklist
   
   - [x] `cargo test -p arrow-cast` (392 passed)
   - [x] Verified the new tests fail without the fix (stash the implementation 
change → 3 tests fail)
   - [x] `cargo clippy -p arrow-cast --all-targets`
   - [x] `cargo fmt -p arrow-cast -- --check`
   - [x] `typos`
   


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