cvp2004 opened a new pull request, #12549:
URL: https://github.com/apache/arrow-rs/pull/12549
# Which issue does this PR close?
- Closes #12510.
# Rationale for this change
`ArrowWriter::try_new` and `ArrowSchemaConverter::convert` panic on a schema
with a `Union` field (top-level or nested), and on the invalid units
`Time32(Microsecond | Nanosecond)` and `Time64(Second | Millisecond)`. The
`try_new` docs say unsupported types such as unions make it fail, so they
should return an error.
# What changes are included in this PR?
In `arrow_to_parquet_type`:
- `Union` returns `ParquetError::NYI("Datatype ... is not yet supported")`,
the same error the writer already returns for a union reached through an
explicit Parquet schema.
- Invalid `Time32` / `Time64` units return an `ArrowError` instead of
hitting `unreachable!`.
# Are these changes tested?
Yes. `test_union_field_returns_error` covers a union at the top level and
inside a struct, list and dictionary, through both `ArrowSchemaConverter` and
`ArrowWriter::try_new`. `test_invalid_time_unit_returns_error` covers the four
invalid units. Both tests panic without the fix.
# Are there any significant user-facing changes?
No. Calls that used to panic now return an error.
# AI usage disclosure
I used Claude Code to draft the fix and the tests. I reviewed the change,
checked that the tests fail without the fix, and ran the parquet checks locally.
--
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]