Force Rewrite Avro Files During Optimization #4058
Open
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.
Summary
This PR implements functionality to force rewrite Avro format files during table optimization, enabling a high-performance write strategy for data ingestion workloads.
Fixes #4057
Motivation
The Performance Trade-off
Different file formats have different performance characteristics:
Avro (row-based):
Parquet/ORC (columnar):
The Solution
This PR enables a best-of-both-worlds strategy:
This is particularly valuable for:
Changes
This PR includes the following changes:
1. Configuration Support
TableProperties.java & TableConfigurations.java
SELF_OPTIMIZING_REWRITE_ALL_AVROproperty (default:false)OptimizingConfigparsing2. Core Logic
CommonPartitionEvaluator.java
needRewriteAvroFileflag to track Avro file presenceaddFragmentFile()to detect Avro filesfileShouldFullOptimizing()to always rewrite Avro files when feature enabledfileShouldRewrite()to prioritize Avro files for rewritingisMinorNecessary()to trigger optimization when Avro files are presentIcebergPartitionPlan.java
ContentFiles.java
isAvroFile()utility method to identify Avro format filesOptimizingConfig.java
rewriteAllAvroconfiguration field with getters/setters3. Documentation
docs/user-guides/configurations.md
4. Tests
MixedTablePlanTestBase.java
appendAvroDataFile()helper method for test data generationTestIcebergPartitionPlan.java & TestUnkeyedPartitionPlan.java
Testing
Checklist
false)