Parquet: Cache codecs by name and level#8182
Merged
nastra merged 4 commits intoapache:masterfrom Aug 1, 2023
Merged
Conversation
Fokko
approved these changes
Jul 31, 2023
nastra
pushed a commit
to nastra/iceberg
that referenced
this pull request
Aug 15, 2023
* Spark: Update antlr4 to match Spark 3.4 (apache#7824) * Parquet: Revert workaround for resource usage with zstd (apache#7834) * GCP: fix single byte read in GCSInputStream (apache#8071) * GCP: fix byte read in GCSInputStream * add test * Parquet: Cache codecs by name and level (apache#8182) * GCP: Add prefix and bulk operations to GCSFileIO (apache#8168) * AWS, GCS: Allow access to underlying storage client (apache#8208) * spotless
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.
Currently when Parquet caches codecs, it does so by name but does not include the level. The can cause a problem if the level changes between writes in the same process. For example, table A is set to zstd-9, and a new insert occurs. Parquet has now cached zstd as the zstd with level 9 config. In the same process, Table B is set to zstd-3 and a new insert occurs. Parquet will look up the codec in its cache by name only, and return the zstd codec with level 9 set. So table B will be written to using zstd-9 instead of zstd-3.
This PR adds a workaround to include the level when caching codecs during writes so the codec with the correct level will be returned. Ultimately this should be fixed in Parquet and a PR is planned for that, though this PR allows this fix to get in sooner rather than later.