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


##########
java/vector/src/main/java/org/apache/arrow/vector/complex/BaseRepeatedValueViewVector.java:
##########
@@ -304,38 +304,44 @@ public void setValueCount(int valueCount) {
     while (valueCount > getOffsetBufferValueCapacity()) {
       reallocateBuffers();
     }
-    final int childValueCount = valueCount == 0 ? 0 : getLengthOfChildVector();
+    final int childValueCount = valueCount == 0 ? 0 : 
getMaxViewEndChildVector();
     vector.setValueCount(childValueCount);
   }
 
-  protected int getLengthOfChildVector() {
+  /**
+   * Get the maximum view length of child vector This method deduces the 
length by considering the
+   * condition i.e., 0 <= offsets[i] + size[i] <= length of the child array.

Review Comment:
   And the condition is more like `argmax_i offsets[i] + size[i]`



##########
java/c/src/test/python/integration_tests.py:
##########
@@ -352,6 +352,51 @@ def test_reader_complex_roundtrip(self):
         ]
         self.round_trip_reader(schema, data)
 
+    def test_listview_array(self):
+        self.round_trip_array(lambda: pa.array(
+            [[], [0], [1, 2], [4, 5, 6]], pa.list_view(pa.int64())
+            # disabled check_metadata since the listview internal field name 
("item")
+            # is not preserved during round trips (it becomes "$data$").

Review Comment:
   nit: make it clear that this applies to Java only



##########
java/vector/src/main/java/org/apache/arrow/vector/complex/BaseRepeatedValueViewVector.java:
##########
@@ -304,38 +304,44 @@ public void setValueCount(int valueCount) {
     while (valueCount > getOffsetBufferValueCapacity()) {
       reallocateBuffers();
     }
-    final int childValueCount = valueCount == 0 ? 0 : getLengthOfChildVector();
+    final int childValueCount = valueCount == 0 ? 0 : 
getMaxViewEndChildVector();
     vector.setValueCount(childValueCount);
   }
 
-  protected int getLengthOfChildVector() {
+  /**
+   * Get the maximum view length of child vector This method deduces the 
length by considering the

Review Comment:
   I'm not sure this is the "view length" (length of an individual view) but 
more like just the end of the child vector in general?



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