vibhatha commented on code in PR #42019:
URL: https://github.com/apache/arrow/pull/42019#discussion_r1630697705
##########
java/vector/src/test/java/org/apache/arrow/vector/TestLargeVarCharVector.java:
##########
@@ -298,39 +298,47 @@ public void testSetLastSetUsage() {
}
}
- @Test(expected = OutOfMemoryException.class)
+ @Test
public void testVectorAllocateNew() {
- try (RootAllocator smallAllocator = new RootAllocator(200);
- LargeVarCharVector vector = new LargeVarCharVector("vec",
smallAllocator)) {
- vector.allocateNew();
- }
+ assertThrows(OutOfMemoryException.class, () -> {
+ try (RootAllocator smallAllocator = new RootAllocator(200);
+ LargeVarCharVector vector = new LargeVarCharVector("vec",
smallAllocator)) {
+ vector.allocateNew();
+ }
+ });
}
- @Test(expected = OversizedAllocationException.class)
+ @Test
public void testLargeVariableVectorReallocation() {
- final LargeVarCharVector vector = new LargeVarCharVector("vector",
allocator);
- // edge case 1: value count = MAX_VALUE_ALLOCATION
- final long expectedAllocationInBytes = BaseValueVector.MAX_ALLOCATION_SIZE;
- final int expectedOffsetSize = 10;
- try {
- vector.allocateNew(expectedAllocationInBytes, 10);
- assertTrue(expectedOffsetSize <= vector.getValueCapacity());
- assertTrue(expectedAllocationInBytes <=
vector.getDataBuffer().capacity());
- vector.reAlloc();
- assertTrue(expectedOffsetSize * 2 <= vector.getValueCapacity());
- assertTrue(expectedAllocationInBytes * 2 <=
vector.getDataBuffer().capacity());
- } finally {
- vector.close();
- }
+ assertThrows(OversizedAllocationException.class, () -> {
+ try (final LargeVarCharVector vector = new LargeVarCharVector("vector",
allocator)) {
+ vector.allocateNew(10000, 1000);
+ vector.reAlloc();
+ }
Review Comment:
new addition?
--
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]