Parquet: Cache codecs by name and level #8182
Merged
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.