arrow-cast: Date32, Timestamp and Time64 parsers reject surrounding whitespace that numeric parsers accept
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Start in arrow-cast at Date32Type::parse and locate the corresponding Timestamp and Time64 parsers. Compare the parser changes from #10374 and #10396, then verify the reproduction for padded and already-trimmed values; done means surrounding ASCII whitespace is accepted for all three temporal types without regressing unpadded inputs.
Written by the indexing model from the issue text.
Description
Describe the bug
Since #10374 and #10396, the integer and float parsers in arrow-cast accept leading and trailing whitespace, but the Date32, Timestamp and Time64 parsers still reject it. With the default CastOptions (safe: true) a padded date or time does not error, it quietly becomes NULL.
To Reproduce
Casting StringArray::from(vec![padded, padded.trim()]) with arrow-cast 60.0.0:
Int32 " 12 " padded null=false | safe=false: ok
Float64 " 1.5 " padded null=false | safe=false: ok
Date32 " 2024-01-05 " padded null=true | safe=false: Cast error: Cannot cast string ' 2024-01-05 ' to value of Date32 type
Timestamp " 2024-01-05T10:00:00 " padded null=true | safe=false: Parser error: Error parsing timestamp from ' 2024-01-05T10:00:00 ': error parsing date
Time64(µs) " 10:00:00 " padded null=true | safe=false: Cast error: Cannot cast string ' 10:00:00 ' to value of Time64(µs) type
The trimmed value parses in every case. Date32Type::parse still goes straight to parse_date_to_days on main.
Seen through DataFusion main: SELECT CAST(' 12 ' AS INT) returns 12, while SELECT CAST(' 2024-01-05 ' AS DATE) fails with Failed to cast field 'lit' from Utf8 to Date32. PostgreSQL accepts both.
Expected behavior
The temporal parsers treat surrounding ASCII whitespace the same way the numeric ones now do.
Additional context
I'd be happy to send a PR. The shape would follow #10374 and #10396: try the input as-is first and trim only when that fails, so values without padding take no extra cost.
Found with Claude Code (Claude Opus 5.5), comparing DataFusion against PostgreSQL 17. The reproduction above was run here.
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 1.4k
- Avg merge
- 3d 46m
- Merged PRs (30d)
- 238
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/arrow-rs
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
`substring` errors when the bytes under a null `Utf8` slot would be cut inside a characterPossibly taken @cakeni claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/arrow-rs#11590 · 1 comment · 1 assignee ·
Maintainers usually reply within 1 day
Similar issues
-
area:desktop priority:p2 type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
fritzprix/libr-agent#2165 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 69/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:ecosystem bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Chelis-Lang/chelis#3942 ·
Maintainers usually reply within 1 day