Repository navigation
Iceberg manifest list partition summaries - #118796
Conversation
`INSERT`, `DELETE` and `UPDATE` on an Iceberg table left the `partitions` field of every new manifest-list entry null, so a reader could not skip a manifest by its partition and had to open all of them. Only the manifest rewrite done by compaction filled that summary in. Each manifest written by these paths holds exactly one partition tuple, so its field summary is exact: `lower_bound` equals `upper_bound` per partition field. The summary is now built from the same partition values and types that go into `data_file.partition` of the manifest itself, and the code that serializes it is shared with the compaction path instead of being nested in it. Unpartitioned tables keep writing a null summary.
Replaces the stateless test with `test_storage_iceberg_no_spark/test_writes_manifest_list_partition_summary.py`, which reads the Avro metadata directly instead of going through the ClickHouse Avro reader. That distinguishes a null `partitions` field from an empty list, which the stateless variant could not, and it covers `s3` as well as `local` storage and both format versions. Each manifest-list entry is paired with the partition tuple stored in the manifest it points at, so a summary attached to the wrong entry fails the test. The unpartitioned case pins the field staying null, and the `DELETE` case covers both the new position-delete manifest and the data manifests carried forward from the parent snapshot.
|
Workflow [PR], commit [b259fa7] Summary: ❌
AI ReviewSummaryThis PR factors the manifest-list Findings
Tests
Final VerdictChanges requested. LLVM Coverage ReportMeasured on commit b259fa7.
Changed lines: Changed C/C++ lines covered: 91/94 (96.81%) · Uncovered code |
|
|
||
| /// Writes the `partitions` field summary of one manifest-list entry. Every manifest written here holds | ||
| /// exactly one partition tuple, so `lower_bound == upper_bound` per partition field; readers use these | ||
| /// bounds to skip whole manifests. Left null when no summaries are supplied (unpartitioned table). |
There was a problem hiding this comment.
This only fixes manifest-list entries whose partition tuple is already present in entry_partition_summaries. On the use_previous_snapshots path below we still copy old_entry.field(f_partitions) verbatim, so the first post-upgrade INSERT / DELETE / UPDATE on a table written before this fix keeps all carried-forward manifests at partitions = null. External Iceberg readers still cannot prune those old manifests by partition, and the new DELETE test does not catch it because its parent snapshot is created by the fixed INSERT path. Please backfill f_partitions when copying a carried-forward entry whose summary is null, or add a regression that starts from a pre-fix manifest list.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 34 s compile time in total, 8 of them have a recent master baseline. |
|
@scanhex12 — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
|
Added While investigating a support escalation on Iceberg scan performance, we hit this from the outside: a table written by ClickHouse 26.1–26.8 has // apache/iceberg api/src/main/java/org/apache/iceberg/expressions/ManifestEvaluator.java:86
private boolean eval(ManifestFile manifest) {
this.stats = manifest.partitions();
if (stats == null) {
return ROWS_MIGHT_MATCH;
}
...Measured against a 98-manifest table on S3, zero-match predicate, cold cache:
So the effect is not confined to ClickHouse's own scan planning — it degrades any downstream engine reading a ClickHouse-written Iceberg table (Spark, Trino, PyIceberg). Two reasons this is worth backporting rather than leaving to the next major:
Verified as not present on any release branch: Note Tagged |
Backport #118796 to 26.8: Iceberg manifest list partition summaries
Backport #118796 to 26.7: Iceberg manifest list partition summaries
Cherry pick #118796 to 26.3: Iceberg manifest list partition summaries
Cherry pick #118796 to 26.6: Iceberg manifest list partition summaries
Backport #118796 to 26.3: Iceberg manifest list partition summaries
Backport #118796 to 26.6: Iceberg manifest list partition summaries
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Write partition field summaries into the Iceberg manifest list
Workflow [PR]
Sync PR [sync-upstream/pr/118796]
Version info
26.9.1.1006(included in26.9and later)26.8.4.4,26.7.8.8,26.6.8.5,26.3.33.90