Skip to content

Cut Iceberg data files when they are smaller than a Parquet row group - #128471

Merged
alexey-milovidov merged 1 commit into
masterfrom
iceberg-cut-files-below-row-group
Nov 1, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
iceberg-cut-files-below-row-group

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Since #127670, MultipleFileWriter compares iceberg_insert_max_bytes_in_data_file and iceberg_compaction_max_bytes_in_data_file with the bytes written to the data file. The Parquet writer writes a row group only when it is complete, and the default output_format_parquet_row_group_size_bytes is 512 MiB before compression, so for any file smaller than a row group the written size stayed near zero until the file was finished, and the limit was ignored.

An INSERT of 16 MiB with iceberg_insert_max_bytes_in_data_file = '1Mi' wrote a single file of 14 MB; with the row groups capped it writes several. The Iceberg compaction also stopped splitting a file above iceberg_data_file_size_upper_threshold_compaction (the private integration test test_compaction_splits_a_file_above_the_upper_threshold fails on every PR). The row groups are now not bigger than the limit. The test 05444_iceberg_insert_file_size_compressed did not catch it, because it sets small row groups explicitly.

Caused by: #127670

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/128471]

Version info

  • Merged into: 26.11.1.1035-master (included in 26.11 and later)

Since `MultipleFileWriter` compares `iceberg_insert_max_bytes_in_data_file` and
`iceberg_compaction_max_bytes_in_data_file` with the bytes written to the file, the limit
was ignored for files smaller than a Parquet row group: the writer writes a row group only
when it is complete, and the default `output_format_parquet_row_group_size_bytes` is
512 MiB before compression, so the size of such a file stayed near zero until it was
finished. An insert of 16 MiB with a limit of 1 MiB wrote a single file of 14 MB, and the
Iceberg compaction no longer split a file above the upper threshold. The row groups are
now not bigger than the limit.

Caused by: #127670

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [3d8e52b]

Summary: ✅


AI Review

Summary

The PR caps the Parquet row-group byte target in MultipleFileWriter at the Iceberg data-file size limit, restoring file rotation when that limit is below the default row-group size. It adds a focused stateless regression test. No actionable findings in the current diff.

Missing context / blind spots
  • ⚠️ Runtime validation remains unconfirmed: no local ClickHouse binary is available, and the retrieved targeted CI report contains no result for 05474_iceberg_insert_file_size_default_row_group. A passing stateless CI result would close this gap.
  • ⚠️ The private compaction caller and test_compaction_splits_a_file_above_the_upper_threshold are absent from this checkout. Private CI must confirm that path.
Final Verdict

Status: ✅ Approve. No code changes requested; runtime validation limitations are noted above.

@clickhouse-gh clickhouse-gh Bot added pr-not-for-changelog This PR should not be mentioned in the changelog comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 1, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 3d8e52bff with master 2898c5432 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

7 translation units recompiled, 10 s compile time in total, 7 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Nov 1, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit 04baaa5 Nov 1, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the iceberg-cut-files-below-row-group branch November 1, 2026 19:21
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 1, 2026
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ClickHouse__ClickHouse that referenced this pull request Nov 20, 2026
…adata cache

A warm read of a Parquet file from object storage or a data lake, whose footer is
already in `ParquetMetadataCache`, still read the offset index of every column chunk
it read before requesting the column data. ClickHouse writes the page index after the
bloom filters, more than `remote_read_min_bytes_for_seek` from the data, so that was a
separate, sequential request per file; since ClickHouse#128471 an Iceberg data file is one row
group, so a warm `IcebergS3` scan paid one request latency per data file and stream.

The offset indexes a read decodes and validates are now kept with the cached footer,
like ClickHouse#125528 keeps statistics: a container shared by the cache cells of a file version,
counted in the cell weight and limited to the footer size (at least 4 KiB). Only a read
that found the footer in the cache adds to it, when it reaches the end of the file, so a
file read once is not moved to SLRU's protected segment; the per-read collection stops
at the bytes the container can still keep (master frees each offset index with its row
group, so an unbounded collection would hold them all until the end of the file). The
offset indexes come from beyond the footer bytes, so they are used and kept only when
the cache key identifies the content (a strong ETag or an immutable content id), the
gate of the columns cache and the page cache. A later read copies the kept offset index
instead of registering its byte range, and the column-index stage decodes only an offset
index it read. New counter `ParquetMetadataCacheOffsetIndexHits`.

Measured (Release, 8 paired rounds, S3 behind a 20 ms first-byte delay): a warm
`IcebergS3` scan of 100M rows in 110 files -32.6% (203 -> 110 GETs), the `s3()` glob of
the same files -31.3%, 10M rows in 16 files -25.7%; `WHERE b = 5`, 1000 tiny files and
20 random-`UInt64` files unchanged (the last makes 40 requests instead of 20, with 21%
fewer bytes). The metadata cache grows by about 640 B per 3-column file.

Based on the analysis and patch by snelheidai in ClickHouse#129400.

Closes ClickHouse#129400

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... and removed comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants