-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[Java] AIOOBE trying to splitAndTransfer DUV within nullable struct #40999
Copy link
Copy link
Closed
Description
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:
@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
Reactions are currently unavailable