ump45nose opened a new pull request, #1379:
URL: https://github.com/apache/arrow-java/pull/1379

   ## What's Changed
   
   `NullableStructWriter` / `SingleStructWriter` (generated from 
`StructWriters.java`) walk the struct field's children in their constructor and 
create a child vector for each one. There was no `case NULL`, so a struct whose 
field has a `Null`-typed child threw `UnsupportedOperationException: Unknown 
type: NULL`. Because `StructVector` builds its writer as soon as it is 
constructed, this broke `new StructVector(field, ...)` and anything that goes 
through it, such as `StructVector#getTransferPair(Field, BufferAllocator)` from 
the issue.
   
   There is no writer for the Null type, so the new case only adds the 
`NullVector` child to the container (with the child's nullability). The 
resulting vector's field now matches the input field, and the other children's 
writers keep working as before.
   
   Tests added to `TestStructVector`:
   - `testStructVectorTransferPairWithNullType`: the reproducer from the issue, 
plus a `transfer()` that checks the value count, struct validity and the 
`NullVector` child.
   - `testStructVectorFromFieldWithNullChild`: builds a `StructVector` straight 
from a `Field` with a Null child and an Int child, then writes through the 
struct writer.
   
   Both fail on `main` with `Unknown type: NULL` and pass with this change. I 
also ran `TestStructVector`, `TestComplexWriter`, `TestListVector`, 
`TestMapVector`, `TestUnionVector`, `TestDenseUnionVector`, 
`TestComplexCopier`, `TestPromotableWriter` and `TestSplitAndTransfer` (all 
pass, both the default and netty runs), and `mvn -pl vector spotless:check`.
   
   AI assistance disclosure: this change, its tests and this description were 
prepared with the help of an AI coding assistant. The tests listed above were 
run locally against this branch.
   
   Closes #830.
   


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