Skip to content

Fix complex types schema evolution typos - #118127

Merged
scanhex12 merged 4 commits into
masterfrom
compltex_type_schema_evolution
Sep 5, 2026
Merged

scanhex12 merged 4 commits into
masterfrom
compltex_type_schema_evolution

Conversation

@scanhex12

@scanhex12 scanhex12 commented Sep 4, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix complex types schema evolution typos


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

Version info

  • Backported to: 26.8.3.42, 26.7.7.75, 26.6.5.106, 26.3.33.47

scanhex12 and others added 2 commits September 4, 2026 15:41
`ExecutableEvolutionFunction::pushNewNode` built the schema evolution path
wrongly when descending into a `list` or `map` field of a struct: it pushed the
edge that unwraps the container instead of the edge that enters the field by
name, while the caller appends the unwrapping edge itself. For a column such as
`outer STRUCT<items: ARRAY<STRUCT<...>>>` the path became `[ARRAY, ARRAY]`
instead of `[STRUCT(items), ARRAY]`, so walking the type applied
`static_pointer_cast<const DataTypeArray>` to a `DataTypeTuple` and
`getNestedType` returned a garbage `shared_ptr`, crashing the server with
`SIGSEGV` while the pipeline was being built.

Containers at the root of a column were unaffected, because there the path is
built solely by the caller, which is why the existing tests did not catch this.

Also replace the unchecked `static_pointer_cast` calls used to walk the type
with `typeid_cast` so that a mismatch throws an exception naming the actual
type instead of reading memory at a wrong offset, and fold the four nearly
identical walks into `resolveSchemaPath`.
@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [b9e1b3d]

Summary: ✅


AI Review

Summary

This PR fixes Iceberg complex-type schema evolution for nested Array and Map containers by making the path builder descend through the containing struct field first and by traversing Map values instead of the key/value tuple wrapper. The added integration coverage matches the bug shape, and I did not find a correctness, safety, or compatibility issue in the implementation.

PR Metadata
  • Changelog category: Bug Fix is reasonable for the user-visible misbehavior.
  • Changelog entry: required, but the current text is too vague and describes the defect as "typos" instead of the user-visible behavior. Suggested replacement: Fixes Iceberg schema evolution for nested Array and Map values inside complex types.
Final Verdict

✅ Approve from a code-review standpoint. I found no code-level blockers; only the changelog entry should be tightened so the release note describes the actual Iceberg fix.

LLVM Coverage Report

Measured on commit b9e1b3d.

Metric Baseline Current Δ
Lines 88.70% 88.70% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 81.10% 81.10% +0.00%

Changed lines: Changed C/C++ lines covered: 18/18 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 4, 2026
@thevar1able thevar1able self-assigned this Sep 4, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Sep 4, 2026
@thevar1able

Copy link
Copy Markdown
Member

This has caused a crash, probably should be a Critical Bug Fix?

scanhex12 and others added 2 commits September 4, 2026 16:48
The equality delete file declares the `data` column as optional while the table
schema has it required. Before #109551
the set for the `notIn` filter was built with the table-schema type and filled from
the delete file columns of a different type, which failed in
`ColumnString::insertRangeFrom` with `Too large size passed to allocator`
(`LOGICAL_ERROR`) or a segmentation fault.

Reuses the `eq_deletes_required_table` fixture through `icebergLocal`, so the test
does not need MinIO and reproduces the failure on 26.4.5.143 locally.

Related: #109551

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Drop the refactoring so that the change against master is three lines and is easy
to backport: `pushNewNode` records the struct field that holds a list or a map as
a `STRUCT` edge (the container edge itself is appended by `lazyInitialize`), and
`traverseAllPaths` descends into the value of a map entry instead of the whole
`(key, value)` pair.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing b9e1b3d27 with master 323d42647 (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, 8 s compile time in total, 7 of them have a recent master baseline.

Job report

@scanhex12
scanhex12 enabled auto-merge September 4, 2026 19:06
@PedroTadim PedroTadim added pr-critical-bugfix pr-must-backport Pull request should be backported intentionally. Use this label with great care! and removed pr-bugfix Pull request with bugfix, not backported by default labels Sep 4, 2026
@scanhex12
scanhex12 added this pull request to the merge queue Sep 4, 2026
Merged via the queue into master with commit 15cb8e0 Sep 5, 2026
174 checks passed
@scanhex12
scanhex12 deleted the compltex_type_schema_evolution branch September 5, 2026 02:35
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 5, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 5, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 5, 2026
clickhouse-gh Bot added a commit that referenced this pull request Sep 5, 2026
Backport #118127 to 26.8: Fix complex types schema evolution typos
clickhouse-gh Bot added a commit that referenced this pull request Sep 10, 2026
Backport #118127 to 26.6: Fix complex types schema evolution typos
clickhouse-gh Bot added a commit that referenced this pull request Sep 10, 2026
Backport #118127 to 26.7: Fix complex types schema evolution typos
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 11, 2026
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 11, 2026
PedroTadim added a commit that referenced this pull request Sep 11, 2026
Backport #118127 to 26.3: Fix complex types schema evolution typos
kewin-robetti pushed a commit to viasoftkorp/ClickHouse that referenced this pull request Sep 18, 2026
@blau-ai blau-ai mentioned this pull request Oct 6, 2026
20 of 30 tasks
@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-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-critical-bugfix 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.

6 participants