viirya commented on code in PR #967:
URL: https://github.com/apache/arrow-java/pull/967#discussion_r2714546508


##########
vector/src/test/java/org/apache/arrow/vector/TestListVector.java:
##########
@@ -1379,6 +1379,45 @@ public void testCopyValueSafeForExtensionType() throws 
Exception {
     }
   }
 
+  @Test
+  public void testNestedEmptyListOffsetBuffer() {
+    // Test that 3-level nested ListVector properly allocates offset buffers
+    // even when nested writers are never invoked. According to Arrow spec,
+    // offset buffer must have N+1 entries. Even when N=0, it should contain 
[0].
+    try (ListVector level0 = ListVector.empty("level0", allocator)) {
+      // Setup List<List<List<Int>>> - 3 levels
+      level0.addOrGetVector(FieldType.nullable(MinorType.LIST.getType()));
+      ListVector level1 = (ListVector) level0.getDataVector();
+      level1.addOrGetVector(FieldType.nullable(MinorType.LIST.getType()));
+      ListVector level2 = (ListVector) level1.getDataVector();
+      level2.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
+
+      // Only allocate level0 - simulates case where all nested levels are 
empty
+      level0.allocateNew();
+      level0.setValueCount(0);

Review Comment:
   ditto



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