You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been working on to improve Parquet's deduplication efficiency for content-addressable storages. These system generally use some kind of a CDC algorithm which are better suited for uncompressed row-major formats. Although thanks to Parquet's unique features I was able to reach good deduplication results by consistently chunking data pages by maintaining a gearhash based chunker for each column.
Deduplication efficiency
The feature enables efficient data deduplication for compressed parquet files on content addressable storage (CAS) systems such as Hugging Face Hub. There is a purpose built evaluation tool is available at https://github.com/kszucs/de used during development to continuously check the improvements and to visually inspect the results. Please take a look at the repository's readme to see how different changes made to parquet files affect the deduplication ratio when they are stored in CAS systems.
Chunk size shows the actual storage required to store the CDC chunked parquet files in a simple CAS implementation.
What changes are included in this PR?
A new column chunker implementation based on CDC algorithm, see more details in the docstrings. The implementation is added to the C++ Parquet writer and exposed in PyArrow as well.
Are these changes tested?
Yes. Tests have been added to the C++ implementation as well as the exposed PyArrow API.
Are there any user-facing changes?
There are two new parquet writer properties on the C++ side:
enable_content_defined_chunking() to enable the feature
content_defined_chunking_options(min_chunk_size, max_chunk_size, norm_factor) to provide additional options
There is a new pq.write_table(..., use_content_defined_chunking=) keyword argument to expose the feature on the Python side.
Is cdc a part of the parquet spec? Or is it a poc?
It is not. You can think of it as an implementation specific feature similar to the existing options to specify how record batches and pages are being split.
Thanks for doing this @kszucs ! I like how this doesn't need any changes to readers.
Questions:
As it stands in this PR, CDC is either on or off for all columns. How about enabling it per column? In general case some columns might not be worthy candidates for it.
Use case described in HF blogpost describes cases where rows are added or removed but not much else is changed. Wouldn't it then make sense to first try a shortcut deduplication where if we identify a duplication in the first column we first check for the same duplication at the same indices in all other columns before running a full hashing pass?
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit dd94c90.
There were no benchmark performance regressions. 🎉
The full Conbench report has more details. It also includes information about 8 possible false positives for unstable benchmarks that are known to sometimes produce them.
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
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.
Rationale for this change
I have been working on to improve Parquet's deduplication efficiency for content-addressable storages. These system generally use some kind of a CDC algorithm which are better suited for uncompressed row-major formats. Although thanks to Parquet's unique features I was able to reach good deduplication results by consistently chunking data pages by maintaining a gearhash based chunker for each column.
Deduplication efficiency
The feature enables efficient data deduplication for compressed parquet files on content addressable storage (CAS) systems such as Hugging Face Hub. There is a purpose built evaluation tool is available at https://github.com/kszucs/de used during development to continuously check the improvements and to visually inspect the results. Please take a look at the repository's readme to see how different changes made to parquet files affect the deduplication ratio when they are stored in CAS systems.
Some results calculated on all revisions of datasets.parquet
Some results calculated on all revisions of food.parquet
Chunk sizeshows the actual storage required to store the CDC chunked parquet files in a simple CAS implementation.What changes are included in this PR?
A new column chunker implementation based on CDC algorithm, see more details in the docstrings. The implementation is added to the C++ Parquet writer and exposed in PyArrow as well.
Are these changes tested?
Yes. Tests have been added to the C++ implementation as well as the exposed PyArrow API.
Are there any user-facing changes?
There are two new parquet writer properties on the C++ side:
enable_content_defined_chunking()to enable the featurecontent_defined_chunking_options(min_chunk_size, max_chunk_size, norm_factor)to provide additional optionsThere is a new
pq.write_table(..., use_content_defined_chunking=)keyword argument to expose the feature on the Python side.I marked all user-facing changes as
EXPERIMENTAL.