Use varint encoding for row count in encoding prefix (#657)#657
Open
tanjialiang wants to merge 1 commit into
Open
Use varint encoding for row count in encoding prefix (#657)#657tanjialiang wants to merge 1 commit into
tanjialiang wants to merge 1 commit into
Conversation
|
@tanjialiang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D97174231. |
tanjialiang
added a commit
to tanjialiang/nimble
that referenced
this pull request
Apr 10, 2026
…or#657) Summary: Pull Request resolved: facebookincubator#657 Change the Nimble encoding prefix row count field from a fixed 4-byte uint32_t to varint encoding. For typical small row counts (< 128 rows), this saves 3 bytes per encoding prefix. The change is gated by a minor version bump (1 → 2) for backward compatibility: - Write path: All encodings now use `Encoding::Options{.useVarintRowCount = true}` when index is enabled - Read path: Files with version >= (0, 2) AND cluster index present decode with varint row counts; older files use the fixed 4-byte format Key changes: - Introduce `NimbleFeatureVersion.h` with `NimbleVersion` struct and `NimbleFeatureVersionRange` for centralized version-to-feature mapping. Future features follow the same pattern: add a version range, gate writer on current version, gate reader on file version. - Bump `kVersionMinor` from 1 to 2 in Constants.h - Thread `useVarintRowCount=true` through VeloxWriter, IndexWriter, and VectorizedStatistics encode paths - Version-gate decode in VeloxReader, SelectiveNimbleReader, SelectiveNimbleIndexReader, ChunkedDecoder, IndexReader, and ReaderBase (stats deserialization) - Fix tools (NimbleDumpLib, NimbleDslLib, EncodingLayoutTrainer, DumpNimbleTablet2DatabaseLib) to use varint-aware encoding traversal and row count reading - Add `useVarintRowCount` parameter to `traverseEncodings()`, `getStreamInputLabel()`, and `getEncodingLabel()` in EncodingUtilities - Update test utilities (TestUtils, VeloxWriterTest) to handle varint prefix parsing - Update ~80 hardcoded physicalSize values in FieldWriterStatsTest to account for smaller prefixes - Add NimbleFeatureVersionTest with version comparison, feature range, and constexpr tests Differential Revision: D97174231
2e83f1a to
f32f36c
Compare
…or#657) Summary: Pull Request resolved: facebookincubator#657 Change the Nimble encoding prefix row count field from a fixed 4-byte uint32_t to varint encoding. For typical small row counts (< 128 rows), this saves 3 bytes per encoding prefix. The change is gated by a minor version bump (1 → 2) for backward compatibility: - Write path: All encodings now use `Encoding::Options{.useVarintRowCount = true}` when index is enabled - Read path: Files with version >= (0, 2) AND cluster index present decode with varint row counts; older files use the fixed 4-byte format Key changes: - Introduce `NimbleFeatureVersion.h` with `NimbleVersion` struct and `NimbleFeatureVersionRange` for centralized version-to-feature mapping. Future features follow the same pattern: add a version range, gate writer on current version, gate reader on file version. - Bump `kVersionMinor` from 1 to 2 in Constants.h - Thread `useVarintRowCount=true` through VeloxWriter, IndexWriter, and VectorizedStatistics encode paths - Version-gate decode in VeloxReader, SelectiveNimbleReader, SelectiveNimbleIndexReader, ChunkedDecoder, IndexReader, and ReaderBase (stats deserialization) - Fix tools (NimbleDumpLib, NimbleDslLib, EncodingLayoutTrainer, DumpNimbleTablet2DatabaseLib) to use varint-aware encoding traversal and row count reading - Add `useVarintRowCount` parameter to `traverseEncodings()`, `getStreamInputLabel()`, and `getEncodingLabel()` in EncodingUtilities - Update test utilities (TestUtils, VeloxWriterTest) to handle varint prefix parsing - Update ~80 hardcoded physicalSize values in FieldWriterStatsTest to account for smaller prefixes - Add NimbleFeatureVersionTest with version comparison, feature range, and constexpr tests Differential Revision: D97174231
f32f36c to
7fe890c
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.
Summary:
Change the Nimble encoding prefix row count field from a fixed 4-byte uint32_t to varint encoding. For typical small row counts (< 128 rows), this saves 3 bytes per encoding prefix.
The change is gated by a minor version bump (1 → 2) for backward compatibility:
Encoding::Options{.useVarintRowCount = true}when index is enabledKey changes:
NimbleFeatureVersion.hwithNimbleVersionstruct andNimbleFeatureVersionRangefor centralized version-to-feature mapping. Future features follow the same pattern: add a version range, gate writer on current version, gate reader on file version.kVersionMinorfrom 1 to 2 in Constants.huseVarintRowCount=truethrough VeloxWriter, IndexWriter, and VectorizedStatistics encode pathsuseVarintRowCountparameter totraverseEncodings(),getStreamInputLabel(), andgetEncodingLabel()in EncodingUtilitiesDifferential Revision: D97174231