Repository navigation
Iceberg: write a single manifest per INSERT across partitions - #128880
Conversation
Each INSERT used to write one manifest file per partition it touched, so a daily-partitioned backfill of N days produced N manifests (401 vs 1 for Spark/PyIceberg on the same data). Now one manifest holds entries for every partition; each entry carries its own partition tuple and the manifest-list summary aggregates contains_null/contains_nan/lower/upper bounds over them. ALTER TABLE ... DROP PARTITION learns to rewrite a data manifest shared with other partitions (surviving entries are kept as EXISTING with their original lineage) instead of throwing NOT_IMPLEMENTED. We probably want to check how it will also work with compaction
|
Workflow [PR], commit [ff80d06] Summary: ✅
AI ReviewSummaryThe PR adds opt-in Iceberg manifests spanning multiple partitions per insert stream, extends manifest compaction to consolidate across partitions, and preserves per-file partition tuples during full compaction. Reviewed head: PR MetadataThe Replace the changelog entry with:
Replace the introductory description with:
Missing context / blind spots
Findings
💡 Nits
Tests
Final VerdictStatus: |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes11 object files changed (+31.25 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units19 translation units recompiled, 186 s compile time in total, 19 of them have a recent master baseline. |
Keep one manifest per INSERT for all partitions, with a `ManifestPartitionSummary` that aggregates `contains_null`/`contains_nan`/bounds over the entries' partition tuples. - Data compaction (`OPTIMIZE TABLE`) mapped each source manifest to a single partition (the last one seen) and stamped it on every file of the rewritten manifest. With multi-partition manifests this mislabels files and partition pruning skips data. Each file now keeps its own partition, and the manifest list gets partition summaries. - `OPTIMIZE TABLE ... MANIFEST` grouped by partition value, so it either reported "already optimal" or split a table back into one manifest per partition. It now groups by (partition spec, schema), with per-entry partition tuples. - `ALTER TABLE ... DROP PARTITION` rewrites a manifest shared with other partitions: surviving entries are written as EXISTING with their original lineage and stats, under the schema the manifest was written with. Manifests with per-file `key_metadata` are rejected, as in manifest compaction. - `getColumnStatisticsForRewrite`, `getEntryLineageForRewrite` and `manifestHasKeyMetadata` are shared between manifest compaction and DROP PARTITION. - The Spark integration test now checks that a shared manifest is rewritten and that Spark reads a multi-partition manifest written by ClickHouse. Related: #128880 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
…in DROP PARTITION - New setting `iceberg_insert_single_manifest_for_all_partitions` (default `false`). When enabled, an `INSERT` writes one manifest for all the partitions it touches; otherwise it writes one manifest per partition, as before. `OPTIMIZE TABLE ... MANIFEST` follows the same setting: without it, manifests are still consolidated per partition, so DROP PARTITION keeps working on them. - `ALTER TABLE ... DROP PARTITION` is back to the `master` behavior: dropping a partition whose manifest is shared with other partitions throws `NOT_IMPLEMENTED`. - Data compaction keeps each file's own partition value regardless of the setting. - `05045` and `05229` are back to the `master` versions, since the default layout is unchanged. `05494` enables the setting and checks the DROP PARTITION rejection. - New test `05495` checks that data compaction keeps the partition of each file of a manifest shared by several partitions. Related: #128880 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…l inserts Every `IcebergStorageSink` commits its own snapshot, and an `INSERT` runs one sink per insert stream (`IcebergMetadata::supportsParallelInsert`). So with `iceberg_insert_single_manifest_for_all_partitions` each stream writes one manifest for all the partitions it received, and the whole `INSERT` writes exactly one manifest only with `max_insert_threads = 1`. Say so in the setting and in the `DROP PARTITION` docs. `05494` now also runs an `INSERT SELECT` with `max_insert_threads = 4`: each of its snapshots adds exactly one manifest, and every manifest spans all partitions. Related: #128880 Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Fix `clang-diagnostic-missing-designated-field-initializers` in `ManifestPartitionSummary` (Build (arm_tidy, 3/4)). - The note about `iceberg_insert_single_manifest_for_all_partitions` and `DROP PARTITION` belongs to the documentation registrations in `registerStorageObjectStorage.cpp` and `TableFunctionObjectStorage.cpp`, not to the generated `docs/reference` pages, which are restored. - New test `05496` covers `OPTIMIZE TABLE ... MANIFEST` across partitions: with the setting, three manifests spanning different partitions are merged into one with every file's partition and lineage preserved, aggregate bounds and counts, and correct filtered reads; without it, one manifest per partition is kept. Related: #128880 Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `max_insert_threads = 4` the insert streams race to commit the next metadata version. The loser logs `FILE_ALREADY_EXISTS` from `writeMetadataFile` as an error and retries, so the result is correct, but the client forwards the log to stderr and the test fails with "having stderror". Run that `INSERT` with `send_logs_level = fatal`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=128880&sha=ed3227f2a83e0b73aa23b5a7083ce2af76f35f24&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29 Related: #128880 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Manifest compaction is its only user since `DROP PARTITION` no longer rewrites manifests. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…into `Compaction.cpp` Manifest compaction is their only user. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pointer Collect each partition's files into the pending manifest and write it after every partition, or once at the end with `iceberg_insert_single_manifest_for_all_partitions`. The manifest-writing failures are already cleaned up by the enclosing commit attempt. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-iceberg-nan-manifest-pruning Master ClickHouse#128880 moved the per-entry statistics copy of the manifest-only rewrite (OPTIMIZE TABLE ... MANIFEST) into getColumnStatisticsForRewrite. The nan_value_counts carry now lives in that helper; no other change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reconcile with #128880 (single manifest per `INSERT`), which also introduced per-file partition tuples in `generateManifestFile` and a range partition summary: - Use master's `ManifestPartitionSummary` class and the required `per_file_partition_values` argument of `generateManifestFile`; drop this branch's duplicates of them. - Keep master's full-compaction handling of manifests spanning several partitions. - `OPTIMIZE TABLE ... MANIFEST` keeps using `DataManifestsRewriter`, with `Grouping::SpanPartitions` when `iceberg_insert_single_manifest_for_all_partitions` is set, as on master. - `ALTER TABLE ... DROP PARTITION` rewrites a manifest shared with other partitions (this branch), so the tests and the setting description that expected `NOT_IMPLEMENTED` for it are updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t-list-bucket-partition-summary Conflict in IcebergWrites.cpp: master (ClickHouse#128880) now aggregates the manifest-list partition summary over all entries of a manifest (`ManifestPartitionSummary`, with `bounds_unavailable` per field) instead of passing one (value, type) pair per field. `canWritePartitionSummary` now checks `bounds_unavailable`, so a manifest with any value that has no Iceberg bound serialization still omits the optional `partitions` field rather than publishing a field summary without bounds, which readers take as "only nulls or NaNs". The write loop takes master's form; its `bounds_unavailable` check and comment are dropped because the guard above already returns early. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each INSERT used to write one manifest file per partition it touched, so a daily-partitioned backfill of N days produced N manifests (401 vs 1 for Spark/PyIceberg on the same data). Now one manifest holds entries for every partition; each entry carries its own partition tuple and the manifest-list summary aggregates contains_null/contains_nan/lower/upper bounds over them. ALTER TABLE ... DROP PARTITION learns to rewrite a data manifest shared with other partitions (surviving entries are kept as EXISTING with their original lineage) instead of throwing NOT_IMPLEMENTED. We probably want to check how it will also work with compaction
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
This feature will reduce the number of manifest files written when writting across multiple partition. Today ClickHouse writes one file per partition. This might lead to a less optimal metadata layout. ClickHouse will instead write only one manifest files but with a partition breakdown within the file.
Workflow [PR]
Sync PR [sync-upstream/pr/128880]
Version info
26.11.1.1296-master(included in26.11and later)