Skip to content

Commit

Permalink
overflow should not create size based on current value
Browse files Browse the repository at this point in the history
  • Loading branch information
itschrispeck committed May 23, 2024
1 parent 0dec8a9 commit 0779406
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ public MutableOffHeapByteArrayStore(PinotDataBufferMemoryManager memoryManager,
int numArrays, int avgArrayLen) {
_memoryManager = memoryManager;
_allocationContext = allocationContext;
_startSize = numArrays * (avgArrayLen + 4); // For each array, we store the array and its startoffset (4 bytes)
int estimatedSize =
numArrays * (avgArrayLen + 4); // For each array, we store the array and its startoffset (4 bytes)
_startSize = estimatedSize > 0 ? estimatedSize : Integer.MAX_VALUE;
expand(_startSize);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ public void maxValueTest()
store.close();
}

@Test
public void startSizeOverflowTest()
throws Exception {
MutableOffHeapByteArrayStore store =
new MutableOffHeapByteArrayStore(_memoryManager, "stringColumn", 3, 1024 * 1024 * 1024);
store.close();
}

@Test
public void overflowTest()
throws Exception {
Expand Down

0 comments on commit 0779406

Please sign in to comment.