jarohen opened a new issue, #40999:
URL: https://github.com/apache/arrow/issues/40999
### Describe the bug, including details regarding any error messages,
version, and platform.
If a `DenseUnionVector` is contained within a nullable `StructVector`, and
that struct has nullable entries, trying to `splitAndTransfer` fails with an
`ArrayIndexOutOfBoundsException`.
Within a struct vector, if an entry is null, then the entries in its
children vectors are undefined, so DUV cannot always expect `typeId >= 0`, and
should guard against it where necessary.
Test case:
```java
@Test
public void testSplitAndTransferDuvInStruct() {
try (StructVector struct = StructVector.empty("struct", allocator)) {
DenseUnionVector duv = struct.addOrGet("duv",
FieldType.notNullable(MinorType.DENSEUNION.getType()),
DenseUnionVector.class);
byte i32TypeId = duv.registerNewTypeId(Field.notNullable("i32",
MinorType.INT.getType()));
duv.addVector(i32TypeId, new IntVector("i32", allocator));
struct.setIndexDefined(0);
duv.setTypeId(0, i32TypeId);
duv.setSafe(0, newIntHolder(42));
struct.setNull(1);
struct.setValueCount(2);
try (StructVector dest = StructVector.empty("dest", allocator)) {
TransferPair pair = struct.makeTransferPair(dest);
pair.splitAndTransfer(0, 2);
assertEquals(2, dest.getValueCount());
assertFalse(dest.isNull(0));
assertEquals(42, dest.getObject(0).get("duv"));
assertTrue(dest.isNull(1));
}
}
}
```
(PR incoming)
### Component(s)
Java
--
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]