Skip to content

fix(connectors): write iceberg sink data into real table partitions - #3969

Open
hubcio wants to merge 1 commit into
masterfrom
fix/iceberg-partition-routing
Open

fix(connectors): write iceberg sink data into real table partitions#3969
hubcio wants to merge 1 commit into
masterfrom
fix/iceberg-partition-routing

Conversation

@hubcio

@hubcio hubcio commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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

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

codecov Bot commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.00000% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.04%. Comparing base (2e42039) to head (4aaa0d3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...re/connectors/sinks/iceberg_sink/src/router/mod.rs 78.00% 34 Missing and 10 partials ⚠️
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     
Components Coverage Δ
Rust Core 66.87% <78.00%> (-18.11%) ⬇️
Java SDK 66.67% <ø> (ø)
C# SDK 75.00% <ø> (+0.03%) ⬆️
Python SDK 90.10% <ø> (ø)
PHP SDK 85.65% <ø> (ø)
Node SDK 95.90% <ø> (+0.09%) ⬆️
Go SDK 68.29% <ø> (ø)
Files with missing lines Coverage Δ
...re/connectors/sinks/iceberg_sink/src/router/mod.rs 71.01% <78.00%> (+35.34%) ⬆️

... and 321 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review PR is waiting on a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(connector-iceberg): partition logic hardcodes dummy values and ignores table spec

1 participant