CurtHagenlocher opened a new pull request, #514:
URL: https://github.com/apache/arrow-dotnet/pull/514
## What's Changed
The Arrow format allows a struct, or a union, with no children. pyarrow's
`struct<>` is an example. Apache.Arrow refused these in three places, and this
PR fixes all three:
- **`NestedType`:** the list constructor treated an empty field list like
`null` and threw `ArgumentNullException("fields")`. It now throws only for
`null`. `StructType` and `UnionType` are the only types that use this
constructor.
- **IPC reader (`MessageSerializer`):** a field with no children has
`childFields == null`. The `Struct_` and `Union` cases now build the type with
no children instead of asserting that `childFields` is non-null.
- **C data interface (`CArrowSchemaExporter`):** a nested type with zero
children is now exported as `n_children = 0` with a null `children` pointer,
which the C data interface allows. It used to throw `NotSupportedException`.
The new `EmptyStructTests` cover:
- the type and the array, including slicing and validity
- round-trips through the IPC stream format, the IPC file format and the C
data interface, both as a top-level column and as the item type of a list
- concatenation
I also checked interop with pyarrow 24 by hand in both directions:
- Apache.Arrow reads a pyarrow-written file containing `struct<>` and
`list<struct<>>`.
- pyarrow reads the file Apache.Arrow writes back, and `validate(full=True)`
passes.
Closes #513.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]