Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -282,16 +282,30 @@ public void reserve(int requiredCapacity) {
if (requiredCapacity > capacity) {
int newCapacity = (int) Math.min(MAX_CAPACITY, requiredCapacity * 2L);
if (requiredCapacity <= newCapacity) {
reserveInternal(newCapacity);
try {
reserveInternal(newCapacity);
} catch (OutOfMemoryError outOfMemoryError) {
throwUnsupportedException(newCapacity, requiredCapacity, outOfMemoryError);
}
} else {
throw new RuntimeException("Cannot reserve more than " + newCapacity +
" bytes in the vectorized reader (requested = " + requiredCapacity + " bytes). As a " +
"workaround, you can disable the vectorized reader by setting "
+ SQLConf.PARQUET_VECTORIZED_READER_ENABLED().key() + " to false.");
throwUnsupportedException(newCapacity, requiredCapacity, null);
}
}
}

private void throwUnsupportedException(int newCapacity, int requiredCapacity, Throwable cause) {
String message = "Cannot reserve more than " + newCapacity +
" bytes in the vectorized reader (requested = " + requiredCapacity + " bytes). As a" +
" workaround, you can disable the vectorized reader by setting "
+ SQLConf.PARQUET_VECTORIZED_READER_ENABLED().key() + " to false.";

if (cause != null) {
throw new RuntimeException(message, cause);
} else {
throw new RuntimeException(message);
}
}

/**
* Ensures that there is enough storage to store capcity elements. That is, the put() APIs
* must work for all rowIds < capcity.
Expand Down