refactor(parquet): replace magic 8 literals with named constants#9751
Open
HippoBaro wants to merge 1 commit intoapache:mainfrom
Open
refactor(parquet): replace magic 8 literals with named constants#9751HippoBaro wants to merge 1 commit intoapache:mainfrom
8 literals with named constants#9751HippoBaro wants to merge 1 commit intoapache:mainfrom
Conversation
The literal `8` appeared in two distinct roles throughout `RleEncoder`, `RleDecoder`, and their tests. Replacing each with a named constant makes the intent explicit and prevents the two meanings from being confused. * `BIT_PACK_GROUP_SIZE = 8` The Parquet RLE/bit-packing hybrid format always bit-packs values in multiples of this count (spec: "we always bit-pack a multiple of 8 values at a time"). Every occurrence related to the staging buffer size, the repeat-count threshold that triggers the RLE decision, and the group-count arithmetic in bit-packed headers now uses this name. * `u8::BITS` (= 8, from std) Used wherever a bit-count is divided by 8 to obtain a byte-count (e.g. `ceil(bit_width, u8::BITS as usize)`). This is a bits-per-byte conversion, a fundamentally different concept from the packing-group size. No behaviour change. Signed-off-by: Hippolyte Barraud <hippolyte.barraud@datadoghq.com>
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.
Which issue does this PR close?
Rationale for this change
The literal
8appeared in two distinct roles throughoutRleEncoder,RleDecoder, and their tests.What changes are included in this PR?
Replacing each with a named constant makes the intent explicit and prevents the two meanings from being confused.
BIT_PACK_GROUP_SIZE = 8The Parquet RLE/bit-packing hybrid format always bit-packs values in multiples of this count (spec: "we always bit-pack a multiple of 8 values at a time"). Every occurrence related to the staging buffer size, the repeat-count threshold that triggers the RLE decision, and the group-count arithmetic in bit-packed headers now uses this name.u8::BITS(= 8, from std) Used wherever a bit-count is divided by 8 to obtain a byte-count (e.g.ceil(bit_width, u8::BITS as usize)). This is a bits-per-byte conversion, a fundamentally different concept from the packing-group size.No behaviour change.
Are these changes tested?
All tests passing.
Are there any user-facing changes?
None.