Skip to content

Add column size statistics in metadata files - #121392

Merged
scanhex12 merged 1 commit into
masterfrom
iceberg_column_sizes_on_disk
Sep 22, 2026
Merged

scanhex12 merged 1 commit into
masterfrom
iceberg_column_sizes_on_disk

Conversation

@scanhex12

@scanhex12 scanhex12 commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Add column size statistics in Avro files


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

Version info

  • Merged into: 26.10.1.410-master (included in 26.10 and later)
  • Backported to: 26.9.2.9, 26.8.11.14, 26.7.14.31

@scanhex12
scanhex12 marked this pull request as draft September 21, 2026 16:17
@clickhouse-gh

clickhouse-gh Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a29b7cd]

Summary: ❌

job_name test_name status info comment
Performance Comparison (arm_release, master_head, 1/6) FAIL Performance dashboard
set_index #0 FAIL dashboard
set_index #1 unstable query history

AI Review

Summary

This PR switches Iceberg data_file.column_sizes from in-memory estimates to sizes derived from the writer and threads that through insert, mutation, and compaction paths. The Parquet-side implementation is plausible, but the patch currently regresses supported non-Parquet Iceberg writes: ORC and Avro tables can still accept INSERT, yet they now stop emitting column_sizes because only the Parquet output format implements the new size hook.

PR Metadata
  • Changelog category looks closer to Bug Fix than Improvement: this changes the meaning of an existing Iceberg metadata field rather than adding a new surface.
  • The current Changelog entry is too vague and names the wrong user-visible surface. Add column size statistics in Avro files does not say that the change is about Iceberg manifest metadata or that it corrects the reported size values.
  • Suggested replacement:
### Changelog category (leave one):
- Bug Fix

### Changelog entry:
Iceberg manifest files now write `data_file.column_sizes` from the encoded Parquet footer, so per-column sizes match the bytes stored in each data file instead of in-memory column sizes.
Findings

⚠️ Majors

  • [src/Processors/Formats/IOutputFormat.h:90] DataFileStatistics::update no longer fills column_sizes, so Iceberg writes now depend entirely on getColumnSizesOnDisk. Only ParquetBlockOutputFormat overrides that hook; ORC and Avro Iceberg tables still accept INSERT, so after this change their manifest entries will stop emitting data_file.column_sizes entirely. Suggested fix: keep a fallback size path for non-Parquet writers, or implement the hook for every write format that Iceberg accepts before removing the old generic accumulation.
Final Verdict

Request changes: the new Parquet path is reasonable, but the current patch regresses supported non-Parquet Iceberg write formats by dropping column_sizes from their manifests.

LLVM Coverage Report

Measured on commit a29b7cd.

Metric Baseline Current Δ
Lines 88.00% 88.00% +0.00%
Functions 91.80% 91.70% -0.10%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 102/128 (79.69%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Sep 21, 2026
virtual bool supportsWritingException() const { return false; }
virtual void setException(const String & /*exception_message*/) {}

virtual std::unordered_map<String, size_t> getColumnSizesOnDisk() const { return {}; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removing the old byteSize() accumulation makes column_sizes depend entirely on IOutputFormat::getColumnSizesOnDisk(), but only ParquetBlockOutputFormat overrides that hook. Iceberg INSERT still supports non-Parquet data files (ORC and Avro; see 04293_iceberg_mutate_non_parquet_reject.sh), so after this change those tables will start committing manifest entries with an empty data_file.column_sizes map. That is a user-visible regression from the current behavior for non-Parquet tables. Please either keep a fallback for formats that cannot report on-disk sizes yet, or implement this hook for every Iceberg write format before removing the old path.

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.

Non interesting case

@clickhouse-gh

clickhouse-gh Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing a29b7cd19 with master d536963b1 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 03f0b2c7e; 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.

Object file sizes

166 object files changed (+169.61 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Processors/Formats/Impl/ParquetBlockOutputFormat.cpp.o 222.92 KiB 254.25 KiB +31.33 KiB (+14.05%)
src/CMakeFiles/dbms.dir/Storages/ObjectStorage/DataLakes/Iceberg/DataFileStatistics.cpp.o 108.59 KiB 130.89 KiB +22.30 KiB (+20.53%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

10984 translation units recompiled, 12113 s compile time in total, 10491 of them have a recent master baseline.

Translation unit Master PR Δ vs median
contrib/aws-cmake/__/aws/generated/src/aws-cpp-sdk-s3/source/S3Client.cpp 19.2 s 14.0 s -5.0 s (-27%)

Job report

@scanhex12
scanhex12 marked this pull request as ready for review September 21, 2026 20:48
@scanhex12
scanhex12 enabled auto-merge September 22, 2026 08:55
@scanhex12 scanhex12 self-assigned this Sep 22, 2026
@scanhex12
scanhex12 added this pull request to the merge queue Sep 22, 2026
Merged via the queue into master with commit 8601c8d Sep 22, 2026
175 of 177 checks passed
@scanhex12
scanhex12 deleted the iceberg_column_sizes_on_disk branch September 22, 2026 09:53
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 22, 2026
@scanhex12 scanhex12 added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Sep 22, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 22, 2026
clickhouse-gh Bot added a commit that referenced this pull request Sep 22, 2026
Backport #121392 to 26.9: Add column size statistics in metadata files
clickhouse-gh Bot added a commit that referenced this pull request Sep 22, 2026
Backport #121392 to 26.8: Add column size statistics in metadata files
PedroTadim added a commit that referenced this pull request Sep 24, 2026
Cherry pick #121392 to 26.7: Add column size statistics in metadata files
clickhouse-gh Bot added a commit that referenced this pull request Sep 24, 2026
Backport #121392 to 26.7: Add column size statistics in metadata files
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 25, 2026
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 25, 2026
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 29, 2026
blau-ai added a commit to Altinity/ClickHouse that referenced this pull request Oct 16, 2026
The 26.8.27 bump combined two Iceberg changes that each predate the other:
upstream ClickHouse#121392 added addColumnSizesOnDisk(), which iterates every schema
field and throws LOGICAL_ERROR if a field reports no on-disk size; Altinity
#2363 added the `unknown`-type write path, which strips columns that are not
physically written (e.g. a column of only the Iceberg `unknown` type) and marks
their schema positions via excludeColumns(). The getters (getColumnSizes /
getNullCounts / getLowerBounds / getUpperBounds) all skip excluded positions,
but addColumnSizesOnDisk() did not, so finalize() aborted with
"Written data file does not report the on-disk size of column <name>" and took
the server down. Skip excluded positions there too, matching the getters.

This crashed test_storage_iceberg_no_spark/test_unknown_type.py (the write
tests, plus the cascade of Connection-refused failures after the server died).
For normal tables excludeColumns() is never called, so isExcluded() is always
false and behavior is unchanged.

Validated by CI on this PR, not locally (no build in this environment).

Signed-off-by: blau-ai <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
@arsenmuk arsenmuk added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-improvement Pull request with some product improvements pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

5 participants