Skip to content

Commit af5d019

Browse files
author
Yicong Huang
committed
fix: allocateNew on inner arrays
1 parent 9841039 commit af5d019

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,9 +1111,11 @@ public void testNestedEmptyLargeListOffsetBuffer() {
11111111
LargeListVector innerList = (LargeListVector) outerList.getDataVector();
11121112
innerList.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
11131113

1114-
// Allocate outer only - simulates case where inner is never written to
1114+
// Allocate both outer and inner - simulates case where inner is never written to
11151115
outerList.allocateNew();
1116+
innerList.allocateNew();
11161117
outerList.setValueCount(0);
1118+
innerList.setValueCount(0);
11171119

11181120
// Get field buffers - this is what IPC serialization uses
11191121
List<ArrowBuf> innerBuffers = innerList.getFieldBuffers();

vector/src/test/java/org/apache/arrow/vector/TestListVector.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,9 +1392,13 @@ public void testNestedEmptyListOffsetBuffer() {
13921392
ListVector level2 = (ListVector) level1.getDataVector();
13931393
level2.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
13941394

1395-
// Only allocate level0 - simulates case where all nested levels are empty
1395+
// Allocate all levels - simulates case where nested levels are never written to
13961396
level0.allocateNew();
1397+
level1.allocateNew();
1398+
level2.allocateNew();
13971399
level0.setValueCount(0);
1400+
level1.setValueCount(0);
1401+
level2.setValueCount(0);
13981402

13991403
// Verify all levels have properly allocated offset buffers
14001404
List<ArrowBuf> level1Buffers = level1.getFieldBuffers();

0 commit comments

Comments
 (0)