Skip to content

Iceberg variant type - #117198

Merged
scanhex12 merged 3 commits into
masterfrom
iceberg_variant
Oct 12, 2026
Merged

scanhex12 merged 3 commits into
masterfrom
iceberg_variant

Conversation

@scanhex12

@scanhex12 scanhex12 commented Aug 30, 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):

Support iceberg variant type. Based on parquet variant reader - #117106


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

Version info

  • Merged into: 26.10.1.2199-master (included in 26.10 and later)

@scanhex12
scanhex12 marked this pull request as draft August 30, 2026 21:46
@zlareb1

zlareb1 commented Aug 31, 2026

Copy link
Copy Markdown
Member

The new getSimpleType branch mapping the Iceberg variant type to Dynamic (SchemaProcessor.cpp) is not exercised by the added test: test_parquet_variant_spark/test.py reads the data files via the s3 table function with the Parquet format and asserts a Variant(...) result type, which is the plain parquet reader path. A real Iceberg table read declares the column as Dynamic while the physical reader yields Variant, so the reconciliation for actual Iceberg tables — including a variant nested inside struct/list/map, and shredded vs unshredded variant shapes differing per data file — is untested. Could you add an integration test that reads a genuine Iceberg table with a variant column (top-level and nested)?

Minor: parseTableSchema now takes the v2 branch for any format_version >= 2 with no upper bound, so a metadata file claiming a future version (4, 5, ...) is silently parsed with the v2 method instead of being rejected. Consider an explicit upper bound with a clear exception.

@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Sep 4, 2026
@subkanthi subkanthi mentioned this pull request Sep 16, 2026
11 of 17 tasks
@scanhex12
scanhex12 marked this pull request as ready for review October 11, 2026 13:35
@clickhouse-gh

clickhouse-gh Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [92653a5]

Summary: ✅


AI Review

Summary

This PR upgrades the generic integration runner to Spark 4.0.0 / Scala 2.13, maps the Iceberg variant primitive to ClickHouse Dynamic, and adjusts the affected Spark-based integration tests. The core variant mapping looks aligned with the existing Parquet variant reader and the Spark 4.0 Iceberg coverage already present in the tree, but one compatibility guard regressed: the schema parser now accepts any future Iceberg format-version >= 2 instead of only the versions we actually support.

PR Metadata
  • Changelog category: Improvement is the right category for this user-visible read capability.
  • Changelog entry: required and present, but the current text is implementation-oriented and includes a raw PR reference instead of the user-visible effect. Suggested replacement: Support reading Iceberg variant columns as Dynamic.
Missing context / blind spots
  • ⚠️ The generic integration runner image changed from Spark 3.5.5 to 4.0.0, but the Docker build jobs are skipped and the broad integration matrix is still pending as of 2026-10-11, so the cross-suite fallout of the image bump is not validated yet.
Findings

⚠️ Majors

  • [src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergMetadata.cpp:368] [dismissed by author -- https://github.com/Iceberg variant type #117198#discussion_r4242675683] format_version >= 2 silently routes every future Iceberg metadata version through today's v2/v3 schema parser. That fails open on un-audited table formats: a future format-version 4+ table can look supported and be partially misread instead of being rejected up front.
    Suggested fix: make the acceptance explicit here (format_version == 2 || format_version == 3) and throw a clear exception for higher versions.
Final Verdict

⚠️ Needs changes — keep the new format-version 3 support explicit, but fail closed for 4+ metadata versions.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Oct 11, 2026
…d expect `Dynamic`

The test imported the `started_cluster` fixture from `helpers.iceberg_utils`, which fails
the style check (unused import and redefinition) and builds its cluster relative to
`helpers`. Reuse the cluster of `test_storage_iceberg_with_spark` instead. Parquet
variant columns are now read as `Dynamic`, so check that, with objects as `JSON`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117198&sha=a750d89583326dfc48b352baecca9ed1c88a66ea&name_0=PR&name_1=Style%20check
PR: #117198

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

clickhouse-gh Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit 92653a515327801191fbee72c9a18969f877d4be was not compared: the CI logs cluster did not answer (exception 241, code 500: { "meta": [ { "name": "file", "type": "String" }, { "name…).

See the job log for details.

Delta 4.0 writes a `.crc` checksum file next to each commit, which breaks the
file counts in the Delta tests. Disable it with
`spark.databricks.delta.writeChecksumFile.enabled`.

Iceberg 1.11 Spark writers set the data file `sort_order_id` to the write order
(apache/iceberg#15832), so the metadata patch that
renumbered the sort order to 0 now makes it mismatch the data files. Remove it.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117198&sha=7d55566536250f6e8697fb194519c50fc5c1d0f8&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20targeted%29
PR: #117198

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@scanhex12
scanhex12 added this pull request to the merge queue Oct 12, 2026
@scanhex12 scanhex12 self-assigned this Oct 12, 2026
Merged via the queue into master with commit 188290b Oct 12, 2026
173 checks passed
@scanhex12
scanhex12 deleted the iceberg_variant branch October 12, 2026 13:16
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
evillique pushed a commit to Onyx2406/ClickHouse that referenced this pull request Oct 12, 2026
…variant"

This reverts commit 188290b, reversing
changes made to 0d2d91b.
raimannma pushed a commit to raimannma/ClickHouse that referenced this pull request Oct 12, 2026
ClickHouse#117198 moved the integration runner to Spark 4.0 and delta-spark 4.0.
Two tests merged after its last CI run used Spark behaviour that
changed as their oracle, and fail on every master run since 188290b.

test_writes_timestamp_ntz_annotation_nested expected Spark to refuse
reading the ambiguous `sc.a.b` leaf, which ClickHouse writes with the
default isAdjustedToUTC=true annotation, into timestamp_ntz. Spark 4.0
reads UTC-adjusted Parquet timestamps into timestamp_ntz without a
shift (SPARK-47447), so the pytest.raises block no longer raises. The
pyarrow asserts on the written schema are the direct check that the
ambiguous path keeps the default annotation, so drop the Spark check
and the comments that present a Spark read as the oracle.

test_write_to_table_with_unsupported_writer_feature_is_rejected made the
table unsupported for writes by enabling Change Data Feed. delta-spark
3.x gave it legacy protocol (1,4), which implies checkConstraints and
generatedColumns, both unsupported by delta-kernel. delta-spark 4.0
writes (1,7,[changeDataFeed,invariants,appendOnly]) instead, all
supported for writes, so the INSERT is accepted. That is correct for an
append-only commit: Spark's table_changes returns the new rows as
inserts. Use a CHECK constraint instead: it gives protocol (1,3) on both
Spark versions and the kernel refuses it with "Feature
'checkConstraints' is not supported". ClickHouse does not evaluate
Delta CHECK constraints, so that refusal has to stay. Assert the feature
name, and expect the ADD CONSTRAINT commit in the log.

Both tests pass on the Spark 4.0 and on the Spark 3.5 runner jars.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
clickhouse-gh Bot pushed a commit that referenced this pull request Oct 13, 2026
Edited by the nightly changelog CI job following .claude/skills/edit-changelog/SKILL.md.

Changelog-revert: 125455 117198 Revert "Iceberg variant type"
Changelog-deleted-entry: 117198 [Improvement] [raw] * Support iceberg variant type. Based on parquet variant reader - #117106. [#117198](#117198) ([Konstantin Vedernikov](https://github.com/scanhex12)).
fm4v added a commit that referenced this pull request Oct 17, 2026
…argeted checks

The coverage selection cannot see a test until a `master` coverage run records it, so a test that landed on `master` after the PR's last CI run escapes it. The `Config Workflow` job of the merge queue (which unshallows the repository) now finds the stateless tests and integration test modules changed on the first-parent history of the queue base after the PR head commit time (or after the merge base, if the PR merged `master` since), keeps the 30 stateless and 10 integration ones whose names share most words with the files the PR changes, and stores them. Both merge-queue targeted checks add them to the selection as mandatory tests. The window and ranking follow #126406.

Replayed on the merge-queue commits of the two known cases: for #117198 the integration selection includes `test_storage_delta/test_writes_interop.py` and `test_storage_delta/test.py`; for #124131 the stateless selection includes `05339_string_filters_during_scan_parquet_short_dictionary_values`.

The merge-queue targeted jobs are no longer cached: their selection depends on the queue entry and the attempt, neither of which is in the digest.
zvonand added a commit to Altinity/ClickHouse that referenced this pull request Oct 27, 2026
huldarchen pushed a commit to huldarchen/ClickHouse that referenced this pull request Nov 2, 2026
A pull request tested against an older `master` can break tests that landed after its last CI run. ClickHouse#117198 was last tested on 2026-10-11 21:34, merged on 2026-10-12 13:16, and broke two `test_storage_delta` tests added to `master` in between, on every lane, until the automatic revert in ClickHouse#125455.

`MergeQueueCI` now runs `Stateless tests (amd_binary, targeted)` and `Integration tests (amd_binary, targeted)` on the merge group, on the `amd_binary` build the queue already makes. They select the tests covering the changed lines of the queued PR, plus the changed tests and the modules owning changed files (integration). The changed stateless tests are left to the merge-queue flaky check, and the tests that failed earlier in the PR are not rerun: its CI already did, and a flaky one would only bounce the PR from the queue. `Targeting` takes the PR number from the merge group head ref and the diff from the PR itself, because the merge group commit is not the PR head.

Both jobs stop at 40 minutes from their start: the stateless one via `--global_time_limit` (3 repetitions instead of 50), the integration one via the pytest session timeout, which a targeted check does not treat as a failure.

Related: ClickHouse#117198
Related: ClickHouse#125455
@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-improvement Pull request with some product improvements 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.

3 participants