lidavidm commented on code in PR #44627:
URL: https://github.com/apache/arrow/pull/44627#discussion_r1833568693


##########
java/vector/src/test/java/org/apache/arrow/vector/TestSplitAndTransfer.java:
##########
@@ -223,6 +227,40 @@ public void testWithZeroVector() {
     // no allocations to clear for ZeroVector
   }
 
+  @Test
+  public void testListVectorWithEmptyMapVector() {
+    // List<element: Map(false)<entries: Struct<key: Utf8 not null, value: 
Utf8> not null>>
+    int valueCount = 1;
+    List<Field> children = new ArrayList<>();
+    children.add(new Field("key", FieldType.notNullable(new ArrowType.Utf8()), 
null));
+    children.add(new Field("value", FieldType.nullable(new ArrowType.Utf8()), 
null));
+    Field structField =
+        new Field("entries", FieldType.notNullable(ArrowType.Struct.INSTANCE), 
children);
+
+    Field mapField =
+        new Field("element", FieldType.notNullable(new ArrowType.Map(false)), 
asList(structField));
+
+    Field listField = new Field("list", FieldType.nullable(new 
ArrowType.List()), asList(mapField));
+
+    ListVector fromListVector = (ListVector) listField.createVector(allocator);
+    fromListVector.allocateNew();
+    fromListVector.setValueCount(valueCount);
+
+    // child vector is empty
+    MapVector dataVector = (MapVector) fromListVector.getDataVector();
+    dataVector.allocateNew();
+    // unset capacity to mimic observed failure mode
+    dataVector.getOffsetBuffer().capacity(0);

Review Comment:
   Hmm, a list vector is supposed to have 1 offset when it's empty. But I 
suppose other parts of the library have this issue/"optimization"



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