wgtmac commented on code in PR #1270:
URL: https://github.com/apache/parquet-mr/pull/1270#discussion_r1543930234
##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/codec/NonBlockedCompressor.java:
##########
@@ -100,7 +102,14 @@ public synchronized void setInput(byte[] buffer, int off,
int len) {
!outputBuffer.hasRemaining(), "Output buffer should be empty. Caller
must call compress()");
if (inputBuffer.capacity() - inputBuffer.position() < len) {
- ByteBuffer tmp = ByteBuffer.allocateDirect(inputBuffer.position() + len);
+ final int newBufferSize;
+ if (inputBuffer.capacity() == 0) {
+ newBufferSize = Math.max(INITIAL_INPUT_BUFFER_SIZE, len);
+ } else {
+ newBufferSize = Math.max(inputBuffer.position() + len,
inputBuffer.capacity() * 2);
Review Comment:
Should we set an upper bound to it instead of blindly doubling the capacity?
In the new code, we may see much larger peak memory compared to the past.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]