Repository navigation
Cut Iceberg data files when they are smaller than a Parquet row group - #128471
Conversation
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]>
|
Workflow [PR], commit [3d8e52b] Summary: ✅
AI ReviewSummaryThe PR caps the Parquet row-group byte target in Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; runtime validation limitations are noted above. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 10 s compile time in total, 7 of them have a recent master baseline. |
…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]>
Since #127670,
MultipleFileWritercomparesiceberg_insert_max_bytes_in_data_fileandiceberg_compaction_max_bytes_in_data_filewith the bytes written to the data file. The Parquet writer writes a row group only when it is complete, and the defaultoutput_format_parquet_row_group_size_bytesis 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
INSERTof 16 MiB withiceberg_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 aboveiceberg_data_file_size_upper_threshold_compaction(the private integration testtest_compaction_splits_a_file_above_the_upper_thresholdfails on every PR). The row groups are now not bigger than the limit. The test05444_iceberg_insert_file_size_compresseddid not catch it, because it sets small row groups explicitly.Caused by: #127670
Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/128471]
Version info
26.11.1.1035-master(included in26.11and later)