You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@parquet.apache.org by "divjotarora (via GitHub)" <gi...@apache.org> on 2026/08/26 04:38:17 UTC
[PR] MINOR: Reuse RLE decoder buffers for packed runs [parquet-java]
divjotarora opened a new pull request, #3749:
URL: https://github.com/apache/parquet-java/pull/3749
### Rationale for this change
`RunLengthBitPackingHybridDecoder` allocated integer and byte buffers for every packed run. This
decoder is used for repetition and definition levels and dictionary IDs, so repeated packed runs
created avoidable allocation and GC pressure.
### What changes are included in this PR?
The decoder now grows and reuses its packed-run buffers, tracks the active value position
independently of buffer capacity, and reads directly from the input stream. It preserves existing
short-input zero padding and EOF behavior. A focused JMH benchmark and regression tests cover
smaller runs following larger runs and truncated final groups.
### Are these changes tested?
Yes. All 689 `parquet-column` tests pass. The focused benchmark reduced normalized allocation from
13.5–13.75 B/value to 0.002 B/value and improved throughput by 27–37.5% across tested bit widths;
all existing `ReadBenchmarks` workloads also completed successfully.
### Are there any user-facing changes?
No. This is an internal performance improvement with no API or format changes.
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] MINOR: Reuse RLE decoder buffers for packed runs [parquet-java]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko merged PR #3749:
URL: https://github.com/apache/parquet-java/pull/3749
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org
Re: [PR] MINOR: Reuse RLE decoder buffers for packed runs [parquet-java]
Posted by "Fokko (via GitHub)" <gi...@apache.org>.
Fokko commented on code in PR #3749:
URL: https://github.com/apache/parquet-java/pull/3749#discussion_r3923617121
##########
parquet-column/src/main/java/org/apache/parquet/column/values/rle/RunLengthBitPackingHybridDecoder.java:
##########
@@ -91,16 +94,25 @@ private void readNext() throws IOException {
int numGroups = header >>> 1;
currentCount = numGroups * 8;
LOG.debug("reading {} values BIT PACKED", currentCount);
- currentBuffer = new int[currentCount]; // TODO: reuse a buffer
- byte[] bytes = new byte[numGroups * bitWidth];
+ if (currentBuffer.length < currentCount) {
+ currentBuffer = new int[currentCount];
+ }
+ currentBufferPosition = 0;
+ int bytesRequired = numGroups * bitWidth;
+ if (packedBytes.length < bytesRequired) {
+ packedBytes = new byte[bytesRequired];
+ }
// At the end of the file RLE data though, there might not be that many bytes left.
int bytesToRead = (int) Math.ceil(currentCount * bitWidth / 8.0);
bytesToRead = Math.min(bytesToRead, in.available());
- new DataInputStream(in).readFully(bytes, 0, bytesToRead);
Review Comment:
Nice, I always found it weird to wrap the stream with a new stream to read the bytes 👍
--
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: issues-unsubscribe@parquet.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@parquet.apache.org
For additional commands, e-mail: issues-help@parquet.apache.org