File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
vector/src/test/java/org/apache/arrow/vector Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -327,8 +327,8 @@ under the License.
327327 <io .netty.tryReflectionSetAccessible>true</io .netty.tryReflectionSetAccessible>
328328 <user .timezone>UTC</user .timezone>
329329 <!-- Note: changing the below configuration might increase the max allocation size for a vector
330- which in turn can cause OOM. -->
331- <arrow .vector.max_allocation_bytes>1048576 </arrow .vector.max_allocation_bytes>
330+ which in turn can cause OOM. Using 1MB - 1byte to simulate the defaul limit of 2^31 - 1 bytes. -->
331+ <arrow .vector.max_allocation_bytes>1048575 </arrow .vector.max_allocation_bytes>
332332 </systemPropertyVariables >
333333 <useModulePath >false</useModulePath >
334334 </configuration >
Original file line number Diff line number Diff line change 2424import java .nio .charset .StandardCharsets ;
2525import org .apache .arrow .memory .BufferAllocator ;
2626import org .apache .arrow .memory .RootAllocator ;
27+ import org .apache .arrow .memory .util .CommonUtil ;
2728import org .apache .arrow .vector .complex .DenseUnionVector ;
2829import org .apache .arrow .vector .complex .FixedSizeListVector ;
2930import org .apache .arrow .vector .complex .ListVector ;
@@ -222,6 +223,17 @@ public void testVariableAllocateAfterReAlloc() throws Exception {
222223 }
223224 }
224225
226+ @ Test
227+ public void testVariableReAllocAbove1GB () throws Exception {
228+ try (final VarCharVector vector = new VarCharVector ("" , allocator )) {
229+ long desiredSizeAboveLastPowerOf2 =
230+ CommonUtil .nextPowerOfTwo (BaseVariableWidthVector .MAX_ALLOCATION_SIZE ) / 2 + 1 ;
231+ vector .reallocDataBuffer (desiredSizeAboveLastPowerOf2 );
232+
233+ assertTrue (vector .getDataBuffer ().capacity () >= desiredSizeAboveLastPowerOf2 );
234+ }
235+ }
236+
225237 @ Test
226238 public void testLargeVariableAllocateAfterReAlloc () throws Exception {
227239 try (final LargeVarCharVector vector = new LargeVarCharVector ("" , allocator )) {
You can’t perform that action at this time.
0 commit comments