[WIP] CLI program to write ALP encode example parquet files#49154
Draft
alamb wants to merge 54 commits intoapache:mainfrom
Draft
[WIP] CLI program to write ALP encode example parquet files#49154alamb wants to merge 54 commits intoapache:mainfrom
alamb wants to merge 54 commits intoapache:mainfrom
Conversation
Co-authored-by: Dhirhan Kanesalingam <dhirhan17@gmail.com>
Also ensure that no line exceeds 90 characters
This reverts commit e85658b42b5373ef7e54295b100d1f083d55dd8d.
Set up base to allow metadata to be before data
This will aloow for easy future extensibility
This commit changes the ALP page layout from grouped metadata to an offset-based interleaved layout: OLD (grouped metadata): [Header][AlpInfos...][ForInfos...][Data...] NEW (offset-based): [Header][Offsets...][Vector0][Vector1]... where each Vector = [AlpInfo|ForInfo|Data] Benefits: - O(1) random access to any vector (previously O(n) to compute offsets) - Better locality for single-vector decompression - Enables parallel decompression without coordination - Storage overhead: 4 bytes per vector (~0.4% for typical pages) Changes: - alp_constants.h: Add OffsetType (uint32_t) for vector offsets - alp_wrapper.cc: EncodeAlp writes offsets + interleaved vectors - alp_wrapper.cc: DecodeAlp reads offsets and jumps directly to vectors - alp_wrapper.cc: GetMaxCompressedSize accounts for offset storage - alp_test.cc: Fix duplicate test name (EmptyInput -> EmptyInputViaCompression)
Update specification and code comments to document the new page layout: - alp.h: Updated AlpEncodedVector class documentation - ALP_Encoding_Specification.md: Updated page layout diagrams and descriptions
Add the ability to pre-compute sampling presets and reuse them for encoding. This is useful for: - Pre-computing presets outside benchmark loops (removes sampling overhead) - Reusing presets across multiple batches with similar data characteristics New public methods in AlpWrapper: - CreateSamplingPreset(): Samples input data and returns a preset - EncodeWithPreset(): Encodes using a pre-computed preset The existing Encode() method now delegates to these new methods internally. Also adds tests: - EncodeWithPreset: Verifies preset-based encoding produces identical output - PresetReuseAcrossBatches: Verifies preset can be reused for multiple encodes
- alp.h: Update serialization flow comment, AlpEncodedVectorView comments - alp.h: Mark AlpMetadataCache as LEGACY (not used with offset layout) - alp_wrapper.cc: Update AlpHeader page layout comment - ALP_Encoding_Specification.md: Fix vector size to be configurable - ALP_Encoding_Specification_terse.md: Complete rewrite for offset layout With the offset-based layout, AlpMetadataCache is no longer needed since the offset array provides O(1) random access directly.
|
Thanks for opening a pull request! If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project. Then could you also rename the pull request title in the following format? or See also: |
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.
This builds on the following PR from @prtkgaur
It contains a binary that creates files using the new ALP encoding here:
I don't intend to merge this PR, rather I plan to use it to create test parquet files, and am posting the PR in case anyone else is interested.
To build
To run
cd arrow/cpp ./build/release/parquet-write-parquet --encoding ALP /tmpThis writes a file like this to /tmp: single_f64_ALP.zip
TODO: make sure the following patterns, from the spec, are covered: