|
23 | 23 | import static org.junit.jupiter.api.Assertions.assertSame; |
24 | 24 | import static org.junit.jupiter.api.Assertions.assertThrows; |
25 | 25 | import static org.junit.jupiter.api.Assertions.assertTrue; |
| 26 | +import static org.junit.jupiter.api.Assertions.fail; |
26 | 27 |
|
27 | 28 | import java.util.ArrayList; |
28 | 29 | import java.util.Arrays; |
29 | 30 | import java.util.List; |
30 | 31 | import java.util.UUID; |
31 | 32 | import org.apache.arrow.memory.ArrowBuf; |
32 | 33 | import org.apache.arrow.memory.BufferAllocator; |
| 34 | +import org.apache.arrow.memory.OutOfMemoryException; |
33 | 35 | import org.apache.arrow.vector.complex.BaseRepeatedValueVector; |
34 | 36 | import org.apache.arrow.vector.complex.LargeListVector; |
35 | 37 | import org.apache.arrow.vector.complex.ListVector; |
|
43 | 45 | import org.apache.arrow.vector.types.pojo.ArrowType; |
44 | 46 | import org.apache.arrow.vector.types.pojo.Field; |
45 | 47 | import org.apache.arrow.vector.types.pojo.FieldType; |
| 48 | +import org.apache.arrow.vector.util.OversizedAllocationException; |
46 | 49 | import org.apache.arrow.vector.util.TransferPair; |
47 | 50 | import org.apache.arrow.vector.util.UuidUtility; |
48 | 51 | import org.junit.jupiter.api.AfterEach; |
@@ -1200,14 +1203,13 @@ public void testSetValueCountAcceptsMaxIntChildValueCount() { |
1200 | 1203 | // The Preconditions check should accept this value (not throw IllegalArgumentException). |
1201 | 1204 | // The child vector may throw OversizedAllocationException due to memory limits, |
1202 | 1205 | // 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); |
1204 | 1207 | vector.setLastSet(0); |
1205 | 1208 | try { |
1206 | 1209 | vector.setValueCount(1); |
1207 | 1210 | } 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) { |
1211 | 1213 | // OversizedAllocationException or other allocation errors are expected |
1212 | 1214 | // when trying to allocate Integer.MAX_VALUE elements — this is fine, |
1213 | 1215 | // the precondition check itself passed. |
|
0 commit comments