Skip to content

Commit 1717f2e

Browse files
committed
adderss comments
1 parent b04380d commit 1717f2e

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,8 @@ public void setValueCount(int valueCount) {
10411041
* TODO: revisit when 64-bit vectors are supported
10421042
*/
10431043
Preconditions.checkArgument(
1044-
childValueCount <= Integer.MAX_VALUE && childValueCount >= 0,
1045-
"LargeListVector doesn't yet support 64-bit allocations: %s",
1044+
childValueCount >= 0 && childValueCount <= Integer.MAX_VALUE,
1045+
"LargeListVector childValueCount must be in [0, Integer.MAX_VALUE] but was: %s",
10461046
childValueCount);
10471047
vector.setValueCount((int) childValueCount);
10481048
}

vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
2323
import static org.junit.jupiter.api.Assertions.assertSame;
2424
import static org.junit.jupiter.api.Assertions.assertThrows;
2525
import static org.junit.jupiter.api.Assertions.assertTrue;
26+
import static org.junit.jupiter.api.Assertions.fail;
2627

2728
import java.util.ArrayList;
2829
import java.util.Arrays;
2930
import java.util.List;
3031
import java.util.UUID;
3132
import org.apache.arrow.memory.ArrowBuf;
3233
import org.apache.arrow.memory.BufferAllocator;
34+
import org.apache.arrow.memory.OutOfMemoryException;
3335
import org.apache.arrow.vector.complex.BaseRepeatedValueVector;
3436
import org.apache.arrow.vector.complex.LargeListVector;
3537
import org.apache.arrow.vector.complex.ListVector;
@@ -43,6 +45,7 @@
4345
import org.apache.arrow.vector.types.pojo.ArrowType;
4446
import org.apache.arrow.vector.types.pojo.Field;
4547
import org.apache.arrow.vector.types.pojo.FieldType;
48+
import org.apache.arrow.vector.util.OversizedAllocationException;
4649
import org.apache.arrow.vector.util.TransferPair;
4750
import org.apache.arrow.vector.util.UuidUtility;
4851
import org.junit.jupiter.api.AfterEach;
@@ -1200,14 +1203,13 @@ public void testSetValueCountAcceptsMaxIntChildValueCount() {
12001203
// The Preconditions check should accept this value (not throw IllegalArgumentException).
12011204
// The child vector may throw OversizedAllocationException due to memory limits,
12021205
// which is expected and unrelated to the precondition validation.
1203-
vector.getOffsetBuffer().setLong(LargeListVector.OFFSET_WIDTH, (long) Integer.MAX_VALUE);
1206+
vector.getOffsetBuffer().setLong(LargeListVector.OFFSET_WIDTH, Integer.MAX_VALUE);
12041207
vector.setLastSet(0);
12051208
try {
12061209
vector.setValueCount(1);
12071210
} catch (IllegalArgumentException e) {
1208-
throw new AssertionError(
1209-
"setValueCount should not reject childValueCount = Integer.MAX_VALUE", e);
1210-
} catch (Exception e) {
1211+
fail("setValueCount should not reject childValueCount = Integer.MAX_VALUE", e);
1212+
} catch (OversizedAllocationException | OutOfMemoryException e) {
12111213
// OversizedAllocationException or other allocation errors are expected
12121214
// when trying to allocate Integer.MAX_VALUE elements — this is fine,
12131215
// the precondition check itself passed.

0 commit comments

Comments
 (0)