|
24 | 24 | import java.nio.charset.Charset; |
25 | 25 |
|
26 | 26 | import org.apache.arrow.memory.RootAllocator; |
| 27 | +import org.apache.arrow.vector.complex.ListVector; |
27 | 28 | import org.apache.arrow.vector.complex.MapVector; |
28 | 29 | import org.apache.arrow.vector.complex.RepeatedListVector; |
29 | 30 | import org.apache.arrow.vector.complex.RepeatedMapVector; |
30 | 31 | import org.apache.arrow.vector.types.MaterializedField; |
| 32 | +import org.apache.arrow.vector.types.Types; |
| 33 | +import org.apache.arrow.vector.types.Types.MinorType; |
31 | 34 | import org.apache.arrow.vector.util.BasicTypeHelper; |
32 | 35 | import org.apache.arrow.vector.util.OversizedAllocationException; |
33 | 36 | import org.apache.arrow.vector.holders.BitHolder; |
@@ -518,4 +521,21 @@ public void testVVInitialCapacity() throws Exception { |
518 | 521 | } |
519 | 522 | } |
520 | 523 |
|
| 524 | + @Test |
| 525 | + public void testListVectorShouldNotThrowOversizedAllocationException() throws Exception { |
| 526 | + final MaterializedField field = MaterializedField.create(EMPTY_SCHEMA_PATH, |
| 527 | + Types.optional(MinorType.LIST)); |
| 528 | + ListVector vector = new ListVector(field, allocator, null); |
| 529 | + ListVector vectorFrom = new ListVector(field, allocator, null); |
| 530 | + vectorFrom.allocateNew(); |
| 531 | + |
| 532 | + for (int i = 0; i < 10000; i++) { |
| 533 | + vector.allocateNew(); |
| 534 | + vector.copyFromSafe(0, 0, vectorFrom); |
| 535 | + vector.clear(); |
| 536 | + } |
| 537 | + |
| 538 | + vectorFrom.clear(); |
| 539 | + vector.clear(); |
| 540 | + } |
521 | 541 | } |
0 commit comments