axreldable commented on code in PR #1099:
URL: https://github.com/apache/arrow-java/pull/1099#discussion_r3032963112


##########
vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java:
##########
@@ -1127,4 +1128,90 @@ private void writeIntValues(UnionLargeListWriter writer, 
int[] values) {
     }
     writer.endList();
   }
+
+  @Test
+  public void testSetValueCountRejectsNegativeChildValueCount() {
+    try (final LargeListVector vector = LargeListVector.empty("list", 
allocator)) {
+      vector.addOrGetVector(FieldType.nullable(MinorType.INT.getType()));
+      vector.allocateNew();
+
+      // Write a negative value into the offset buffer to simulate a corrupted 
offset.
+      // The Preconditions check should reject any negative childValueCount.
+      vector.getOffsetBuffer().setLong(LargeListVector.OFFSET_WIDTH, -1L);
+      vector.setLastSet(0);
+
+      assertThrows(
+          IllegalArgumentException.class,

Review Comment:
   The error message throwing here is a bit confusing: `IllegalArgument 
LargeListVector doesn't yet support 64-bit allocations: -1`



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