Skip to content

Keep Iceberg annotations of struct, list and map fields made optional - #2986

Open
zvonand wants to merge 5 commits into
antalya-26.8from
fix/antalya-26.8/agg-states-audit
Open

zvonand wants to merge 5 commits into
antalya-26.8from
fix/antalya-26.8/agg-states-audit

Conversation

@zvonand

@zvonand zvonand commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

An annotated Tuple, Array or Map Iceberg field made optional by another engine kept files written with the old schema unreadable (ICEBERG_SPECIFICATION_VIOLATION, or states read as String). The annotation now still applies.

Also trims tests and duplicated code of #2680: gtests covered by functional tests are removed, overlapping functional tests are merged, and 05814 now checks in system.query_log that the table's setting reaches the other nodes of a cluster.

Related: #2680 (comment)

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 to CHANGELOG.md):

Fix reading an Iceberg table with an AggregateFunction state inside a Tuple, Array or Map column after another engine made the column optional.

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

An annotated `Tuple`, `Array` or `Map` field that another engine made
optional in a new schema stopped matching its inherited `clickhouse.type`
annotation. Files written with the old schema then could not be read:
the schema transform threw `ICEBERG_SPECIFICATION_VIOLATION`, or the
states were read as `String`. ClickHouse reads an optional struct, list
or map as a required one, so the annotation still applies to it.

Addresses defect 3 of #2680 (comment)
Related: #2680
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [fe1c548]

…ormats

Tests:
- Remove gtests that functional tests already cover: five
  `IcebergSchemaProcessor` cases, `AnnotationKeepsAggregateStateVersion`
  (an `Array` of version 0 states is added to `04673` instead),
  `ModifyColumnComparesWithTheAnnotatedTypeOfAState` (a `MODIFY` to another
  aggregate function is added to `05816` instead) and
  `UnchangedSchemaSendsOnlyThePropertyChanges`. Trim
  `ClickHouseTypeAnnotationsInEffectForSchema` and the `MODIFY COLUMN`
  metadata generator test to what nothing else covers.
- Merge `05815` into `05814`, and `05817` and `05819` into `05818`, which
  now covers metadata another engine edited. Drop the `SHOW CREATE` checks
  of `05814`.
- Remove the unused `settings` parameter of `make_iceberg_s3`.

Code:
- `getSchemaTransformationDag` takes the field types the schemas were
  registered with instead of parsing them and their annotations again.
- One helper in `registerStorageObjectStorage.cpp` resolves the table's
  `allow_aggregate_function_states_in_open_formats` for both object storage
  and data lake engines, replacing `setTableAllowAggregateFunctionStates`.
- The cluster query rewrite adds the `SETTINGS` of the query in one place.

Related: #2680
The cluster check compared only results, which are the same whether or not
the other nodes apply the recorded types: `SimpleAggregateFunction(sum, Int64)`
equals `Int64`. It now reads the secondary queries from `system.query_log`
and checks that the table's `allow_aggregate_function_states_in_open_formats`
reached them: an enabled one as an argument of the table function, a disabled
one in the query's `SETTINGS`. Without the rewrite in
`StorageObjectStorageCluster::updateQueryForDistributedEngineIfNeeded` the
check fails.

Restore the gtest `SkippingTheSchemaDoesNotPublishIt`, the only test of
`SchemaParsing::Skip`.
@zvonand

zvonand commented Dec 2, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T13:40:54.850825Z c9b1bc1 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: c9b1bc12f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

The gtest `ModifyColumnChangingOnlyTheSimpleAggregateFunctionKeepsTheSchema`
removed in this PR was the only test of a `MODIFY COLUMN` that adds a
`SimpleAggregateFunction` annotation to a plain column or changes only its
aggregate function. `05428` now runs both, `Int64` to
`SimpleAggregateFunction(sum, Int64)` and then to
`SimpleAggregateFunction(max, Int64)`, and checks that the rows written with
both schemas read with the new type and that `current-schema-id` stays the same.
@zvonand

zvonand commented Dec 3, 2026

Copy link
Copy Markdown
Member Author

@blau-ai

@zvonand
zvonand marked this pull request as ready for review December 3, 2026 09:05
@blau-ai

blau-ai commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

CI triage for fe1c548: 1 failure (2 check entries for the same job). 0 PR-caused, 1 pre-existing on antalya-26.8.

Check Classification PR-caused? Next step
RegressionTestsRelease / Common (settings) / settings (+ its Regression release settings status) pre-existing: the regression snapshot doesn't have the new setting from #2680 No (high confidence) Add the setting to the settings regression snapshot (clickhouse-regression). Nothing to change in this PR

Every other check that ran is green: 173 pass. That includes all the stateless (amd_debug, asan_ubsan, binary, cas storage), integration (asan_ubsan old analyzer 1–8/8) and unit (asan_ubsan) jobs in the praktika report. The 209 "skipping" entries are jobs this PR's CI config doesn't schedule (msan/tsan/arm builds and their tests, stress, fuzzers); they are not failures. Nothing needs to change in this PR.

RegressionTestsRelease / Common (settings) / settings: pre-existing on antalya-26.8, not PR-caused

Job: https://github.com/Altinity/ClickHouse/actions/runs/46901330425/job/143620969785

✘ [ Fail ] '/settings/default values/allow_aggregate_function_states_in_open_formats' (1s 649ms)
      assert that(
             ^ is = SnapshotNotFoundError(
        name=allow_aggregate_function_states_in_open_formats
1873 scenarios (1867 ok, 1 failed, 5 xfail)

What happened: the settings/default values suite compares every setting in system.settings against a stored snapshot. allow_aggregate_function_states_in_open_formats has no snapshot entry, so this one scenario fails. The other 1867 pass.

Why it is not this PR:

Fix (outside this PR): add a default-value snapshot entry for allow_aggregate_function_states_in_open_formats (default 0 / false) to the settings suite in the clickhouse-regression repo. That turns this check green for this PR and for antalya-26.8 MasterCI. I can only write to Altinity/ClickHouse, so a human needs to make that change. After it lands, re-run this job; no new commit is needed here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants