fix(connectors): write iceberg sink data into real table partitions - #3969
Open
hubcio wants to merge 1 commit into
Open
fix(connectors): write iceberg sink data into real table partitions#3969hubcio wants to merge 1 commit into
hubcio wants to merge 1 commit into
Conversation
The Iceberg sink built its partition key from an empty PartitionSpec::builder() with hardcoded zero literals, so every record landed in one dummy partition (e.g. year=1970) whatever the table's spec said, and a batch spanning several partitions was never split. Read the default partition spec from table metadata instead and push every batch through one TableWriter: partitioned tables split it with RecordBatchPartitionSplitter and fan out to one data file writer per partition value, unpartitioned tables map it to the single key of their spec (with one null per void field, which the commit-time arity check requires). Files finalized by a failed batch are deleted before the error is returned so nothing is left orphaned on the object store; files are kept on commit failure because the catalog may already have applied the commit. Ports #3860 with its review feedback applied. Fixes #3853
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3969 +/- ##
=============================================
- Coverage 84.08% 70.04% -14.04%
Complexity 1358 1358
=============================================
Files 1217 1217
Lines 171841 147325 -24516
Branches 139597 115082 -24515
=============================================
- Hits 144484 103190 -41294
- Misses 23428 40171 +16743
- Partials 3929 3964 +35
🚀 New features to boost your workflow:
|
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.
The Iceberg sink built its partition key from an empty
PartitionSpec::builder() with hardcoded zero literals, so every
record landed in one dummy partition (e.g. year=1970) whatever the
table's spec said, and a batch spanning several partitions was
never split.
Read the default partition spec from table metadata instead and
push every batch through one TableWriter: partitioned tables split
it with RecordBatchPartitionSplitter and fan out to one data file
writer per partition value, unpartitioned tables map it to the
single key of their spec (with one null per void field, which the
commit-time arity check requires). Files finalized by a failed
batch are deleted before the error is returned so nothing is left
orphaned on the object store; files are kept on commit failure
because the catalog may already have applied the commit.
Ports #3860 with its review feedback applied. Fixes #3853
Co-authored-by: Ashutosh Prajapati asprajapati@deqode.com