rymurr commented on a change in pull request #7275:
URL: https://github.com/apache/arrow/pull/7275#discussion_r449474540



##########
File path: 
java/vector/src/main/java/org/apache/arrow/vector/validate/ValidateVectorVisitor.java
##########
@@ -135,6 +136,45 @@ public Void visit(ListVector vector, Void value) {
     return dataVector.accept(this, null);
   }
 
+  @Override
+  public Void visit(LargeListVector vector, Void value) {
+
+    FieldVector dataVector = vector.getDataVector();
+
+    if (vector.getValueCount() > 0) {
+
+      ArrowBuf offsetBuf = vector.getOffsetBuffer();
+      long minBufferSize = (vector.getValueCount() + 1) * 
LargeListVector.OFFSET_WIDTH;
+
+      if (offsetBuf.capacity() < minBufferSize) {
+        throw new IllegalArgumentException(String.format("offsetBuffer too 
small in vector of type %s" +
+                " and valueCount %s : expected at least %s byte(s), got %s",
+            vector.getField().getType().toString(),
+            vector.getValueCount(), minBufferSize, offsetBuf.capacity()));
+      }
+
+      long firstOffset = vector.getOffsetBuffer().getLong(0);
+      long lastOffset = 
vector.getOffsetBuffer().getLong(vector.getValueCount() * 
LargeListVector.OFFSET_WIDTH);
+
+      if (firstOffset < 0 || lastOffset < 0) {
+        throw new IllegalArgumentException("Negative offsets in list vector");
+      }
+
+      long dataExtent = lastOffset - firstOffset;
+
+      if (dataExtent > 0 && (dataVector.getDataBuffer() == null || 
dataVector.getDataBuffer().capacity() == 0)) {
+        throw new IllegalArgumentException("valueBuffer is null or capacity is 
0");
+      }
+
+      if (dataExtent > dataVector.getValueCount()) {
+        throw new IllegalArgumentException(String.format("Length spanned by 
list offsets (%s) larger than" +
+            " data vector valueCount (length %s)", dataExtent, 
dataVector.getValueCount()));
+      }
+    }
+
+    return dataVector.accept(this, null);

Review comment:
       value is always of type `Void`. None of the other visitors pass value to 
children.




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

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to