feat(storage): default parquet codec to zstd for flink and spark 3.5+ - #19685
Draft
cshuo wants to merge 1 commit into
Draft
feat(storage): default parquet codec to zstd for flink and spark 3.5+#19685cshuo wants to merge 1 commit into
cshuo wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19685 +/- ##
==========================================
Coverage 77.83% 77.84%
- Complexity 33064 33143 +79
==========================================
Files 2525 2527 +2
Lines 139670 139963 +293
Branches 16800 17164 +364
==========================================
+ Hits 108709 108949 +240
- Misses 23347 23395 +48
- Partials 7614 7619 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Collaborator
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.
Describe the issue this Pull Request addresses
Closes #19684.
Flink and Spark 3.5+ currently default Parquet base and native log files to GZIP, which provides a good compression ratio but adds significant CPU overhead to the write path. ZSTD offers a better balance of compression throughput and storage efficiency. Spark 3.3/3.4 require a compatibility exception because Hudi's non-vectorized file-group reader can still encounter the PARQUET-2160 off-heap leak when reading ZSTD files.
This implements the engine- and runtime-specific behavior discussed in #19615.
Summary and Changelog
hoodie.parquet.compression.codecvalues in DataSource/SQL, direct clients, metadata table services, and derived configurations.zstd-jniin the Flink bundle and continue relying on the Spark runtime dependency without adding it to Spark bundles.Impact
Upgrading changes the default codec for writes without an explicit codec under Flink and Spark 3.5+. Existing Parquet files remain readable and a table can contain files using different codecs. Spark 3.3/3.4 and Java write defaults remain GZIP.
The Flink bundle gains the profile-compatible
zstd-jniclasses and native libraries. Spark bundles do not duplicatezstd-jni; supported Spark runtimes provide it through Spark's dependency set. Explicit codec configuration continues to take precedence.Risk Level
Medium. This intentionally changes a write default and adds a native dependency to the Flink bundle. The risk is mitigated by retaining GZIP on affected Spark versions and Java clients, preserving explicit overrides, verifying Spark 3.3 and 3.5 profiles independently, testing the Flink write-client path, and writing a Parquet file whose footer reports ZSTD compression.
Validation performed:
HoodieStorageConfig,HoodieWriteConfig, and Hadoop Parquet writer tests.TestDataSourceUtils#testSparkVersionSpecificParquetCompressionCodecDefaultwith Spark 3.3 and Spark 3.5 profiles.TestFlinkWriteClients#testParquetCompressionCodecDefaultAndOverridewith the Flink 2.1 profile.zstd-jniresolution.Documentation Update
Updated the root and Spark datasource documentation, plus the configuration description, to describe the version-specific defaults and warn that Spark 3.3/3.4 Hudi file-group readers may encounter PARQUET-2160 when reading ZSTD Parquet files. Spark 3.5+ is recommended.
Contributor's checklist