ORC-2619: Fix estimateRgEndOffset slop calculation for incompressible data#2620
Open
thexiay wants to merge 1 commit intoapache:mainfrom
Open
ORC-2619: Fix estimateRgEndOffset slop calculation for incompressible data#2620thexiay wants to merge 1 commit intoapache:mainfrom
thexiay wants to merge 1 commit intoapache:mainfrom
Conversation
a9ffd5d to
c52545c
Compare
… data The stretchFactor calculation in estimateRgEndOffset did not account for the 2-byte RLEv2 DIRECT run header. This caused insufficient buffer allocation when data is incompressible, leading to 'Buffer size too small' errors. Fix: Include RLE_V2_HEADER_SIZE in the worst-case payload calculation. Add test demonstrating the issue with the old formula.
c52545c to
076e787
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Fix the
estimateRgEndOffsetslop calculation inRecordReaderUtils.javato account for the 2-byte RLEv2 DIRECT run header.Problem
The old formula:
only considers the value payload (512 * 8 = 4096 bytes) but ignores the 2-byte RLE header. For
bufferSize = 1024, this givesstretchFactor = 5, which is one block short when data is incompressible.Fix
This correctly yields
stretchFactor = 6, ensuring enough compressed blocks are allocated.How was this patch tested?
Added
testTruncatedRleV2DirectRunAtEstimatedEndFailsinTestInStream.javathat:IllegalArgumentException: Buffer size too smallThis proves the old slop estimation was insufficient.
Closes #2619