Skip to content

Add Iceberg tables from the DuckDB Iceberg extension tests - #130010

Open
alexey-milovidov wants to merge 12 commits into
masterfrom
iceberg-duckdb-tables
Open

alexey-milovidov wants to merge 12 commits into
masterfrom
iceberg-duckdb-tables

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Adds 71 Iceberg tables from the DuckDB Iceberg extension tests as stateless tests, with the expected results taken from the extension's sqllogictest files.

Source: data/persistent of https://github.com/duckdb/duckdb-iceberg/tree/b57f45c2c78965c71f699aa23ae73c292923668e/data/persistent (MIT License). Expected results come from test/sql/local/**/*.test at the same commit. The data is in tests/queries/0_stateless/data_iceberg/duckdb/ (1.5 MB). Its README.md gives the provenance, the license text, and lists what was left out and why: benchmark, the four lineitem copies (too large), the encrypted tables, big_query_error, generated_bounds, utf8_trunc_bounds, snapshot_refs and missing_map_keys/missing_value. The upstream layout data/persistent/<table> is kept, because the table locations are relative and some manifest lists point into other tables. Non-standard metadata file names are kept as they are and selected with iceberg_metadata_file_path. No upstream file is modified. Tables with % in their file names are stored in special_paths.tar.

Tests:

  • 05620_iceberg_duckdb_identity_partitions: identity partitions of every primitive type, including decimals up to decimal(36, 23), time, timestamptz_ns and fixed. Also partition evolution, and identity sources missing from the data files, both top-level and nested.
  • 05621_iceberg_duckdb_deletes: equality deletes (unpartitioned, partitioned, across partitions, bucket-partitioned), legacy bare-blob deletion vectors, a moved deletion vector, and corrupted deletion-vector bitmaps.
  • 05622_iceberg_duckdb_schema_and_types: initial-default for all types (top-level and in a struct), case-sensitive names, a data file from another directory, schema.name-mapping.default, data files with nested types that don't match the schema, map keys without field ids, uuid, timestamptz_ns, decimal(38, 38).
  • 05623_iceberg_duckdb_legacy_metadata: v1 deprecated schema/partition-spec/embedded manifests, partition fields without field ids, snapshots without schema-id, v1 manifests without optional keys, v1 EXISTING entries, v1 tables upgraded to v3, and row lineage with and without first_row_id.
  • 05624_iceberg_duckdb_invalid_metadata: format version 4 and 0, missing location, last-updated-ms, schema-id or spec-id, a manifest newer than the table, malformed decimal types, and a manifest list with an unknown partition spec id.
  • 05625_iceberg_duckdb_filters: IS NULL, IS NOT NULL, IS DISTINCT FROM, a map with bounds, and a CASE expression filter. Passes today.

When ClickHouse has no specific error yet for invalid metadata, the test prints rejected for any exception except POCO_EXCEPTION, LOGICAL_ERROR, FILE_DOESNT_EXIST or a rejected metadata file name.

Must be merged after the fixes of:

Related: #129990
Related: #129988
Related: #129991
Related: #129992
Related: #129995
Related: #129996
Related: #130002
Related: #130019
Related: #130020
Related: #130021
Related: #128304

Which tests fail until those fixes, and why:

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

The tables of `data/persistent` of https://github.com/duckdb/duckdb-iceberg at
b57f45c2c78965c71f699aa23ae73c292923668e (MIT License) with the expected results
of its sqllogictest files: identity partitions of all types, equality deletes,
deletion vectors, `initial-default`, name mapping, data files that don't match
the schema, deprecated v1 metadata, row lineage, time travel and invalid metadata.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov alexey-milovidov added the pr-not-for-changelog This PR should not be mentioned in the changelog label Nov 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6f06a72]

Summary: ⏳

job_name test_name status info comment
Stateless tests (arm_asan_ubsan, targeted) FAIL
05620_iceberg_duckdb_identity_partitions FAIL cidb
05623_iceberg_duckdb_legacy_metadata FAIL cidb
05624_iceberg_duckdb_invalid_metadata FAIL cidb
05621_iceberg_duckdb_deletes FAIL cidb
05620_iceberg_duckdb_identity_partitions FAIL cidb
05623_iceberg_duckdb_legacy_metadata FAIL cidb
05624_iceberg_duckdb_invalid_metadata FAIL cidb
Too many test failures FAIL cidb
Stateless tests (amd_asan_ubsan, db disk, distributed plan, targeted) FAIL
05621_iceberg_duckdb_deletes FAIL cidb
05623_iceberg_duckdb_legacy_metadata FAIL cidb
05624_iceberg_duckdb_invalid_metadata FAIL cidb
05620_iceberg_duckdb_identity_partitions FAIL cidb
05620_iceberg_duckdb_identity_partitions FAIL cidb
05624_iceberg_duckdb_invalid_metadata FAIL cidb
05623_iceberg_duckdb_legacy_metadata FAIL cidb
Too many test failures FAIL cidb
Fast test (arm_darwin) DROPPED
Build (arm_darwin) DROPPED
Stateless tests (amd_debug, sequential) DROPPED
Stateless tests (amd_debug, distributed plan, s3 storage, parallel) DROPPED
Stateless tests (amd_debug, distributed plan, s3 storage, sequential) DROPPED
Stateless tests (amd_tsan, s3 storage, targeted) DROPPED
Stateless tests (arm_asan_ubsan, azure, targeted) DROPPED
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) DROPPED

AI Review

Summary

The PR adds six stateless Iceberg interoperability tests using fixtures and expected results from a pinned DuckDB Iceberg extension revision. No new code findings remain, and the previous oversized lineitem fixture finding is addressed. Approval remains pending execution evidence for the new tests and completion of their documented prerequisites.

Tests
  • ⚠️ The current Praktika report has no completed results for 05620_iceberg_duckdb_identity_partitions, 05621_iceberg_duckdb_deletes, 05622_iceberg_duckdb_schema_and_types, 05623_iceberg_duckdb_legacy_metadata, 05624_iceberg_duckdb_invalid_metadata, or 05625_iceberg_duckdb_filters. The completed Fast test excludes all six through no-fasttest. The author reports prerequisite failures as of 2026-11-25. Obtain passing stateless CI results for all six after the prerequisite fixes land; upstream expectations and fixture verification alone do not demonstrate that ClickHouse passes them.
Final Verdict

Status: ⚠️ Request changes

Complete the documented prerequisite fixes and obtain passing CI results for all six new tests. No new inline comments or thread changes are needed.

The snapshot id 9876543210123456789 of `equality_delete_cross_partition` and
`equality_delete_extra_column` does not fit the type `long` of the Iceberg spec,
so `vfinal.metadata.json` has to be refused (DuckDB accepts it). The table
`equality_delete_extra_column` before the delete is still read.

Related: #130002
Related: #130019
Related: #130020
Related: #130021
Related: #128304

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Nov 7, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 8, 2026
…the data file

The `nested_source` table of the DuckDB Iceberg extension tests is partitioned
by identity on `address.country`, and its data file stores only `address.city`,
so the value is only in the manifest. `SELECT *`, an explicit PREWHERE over
`address` and a post-reader filter over `address` returned NULL for it.

The table files are byte-identical to those of
ClickHouse#130010 at the same path.

Closes ClickHouse#129995

Co-Authored-By: Claude Opus 5.5 <[email protected]>
arsenmuk pushed a commit to melvynator/ClickHouse that referenced this pull request Nov 8, 2026
`SchemaConverter::processSubtreeMap` dropped the MAP interpretation of a
Parquet group for any requested `Tuple`, so that the literal shape of the
schema tree, `Tuple(key_value Array(Tuple(key, value)))`, stays readable.
`processSubtreeTuple` then matched the requested elements to the group's
children by name. The only child is the repeated `key_value` group, so a
Tuple such as `Tuple(value String)` matched nothing, every element became a
missing column, and the read returned defaults (`NULL` for the Iceberg case)
instead of the data or an error. With
`input_format_parquet_allow_missing_columns = 0` it failed with
`THERE_IS_NO_COLUMN`, which is not a type error either.

This is how an Iceberg table whose schema has `payload struct<value: string>`
read a data file that stores `payload` as a map (ClickHouse#130020): the requested type
comes from the table schema, the file has no field ids, and the column is
matched by name. Plain `file()` with an explicit structure shows the same in
every nesting position (top level, list element, map value, struct field).

Keep the literal fallback only for a Tuple that describes the map's tree:
an unnamed Tuple (matched by position), or a named Tuple that has an element
named like the repeated group, matched as `processSubtreeTuple` matches it
(column mapper + `case_insensitive_column_matching`). Any other Tuple now
reaches the existing `parquet type is Map, requested type is ...`
`TYPE_MISMATCH`, the same error every other kind mismatch in this reader
raises. A query that does not read the column is unaffected. The check runs
after the structure checks, so a MAP-annotated group without the MAP
structure keeps the literal fallback for any request.

A generic "a named Tuple that matches no child is an error" rule in
`processSubtreeTuple` would be wrong for structs: Iceberg schema evolution
(drop one field, add another) legitimately produces it and NULL is the right
answer there. Only the map case is a kind mismatch.

The test adds the `map_to_struct` table of the DuckDB Iceberg extension tests
(duckdb/duckdb-iceberg b57f45c2c78965c71f699aa23ae73c292923668e), at the same
path and with the same content as ClickHouse#130010.

Closes ClickHouse#130020

Co-Authored-By: Claude Opus 5.5 <[email protected]>
arsenmuk pushed a commit to melvynator/ClickHouse that referenced this pull request Nov 8, 2026
A row's `_row_id` is the value stored in the data file, or `first_row_id`
plus its position where the file stores NULL; `_last_updated_sequence_number`
falls back to the data sequence number the same way. The manifest-level
pruning used the declared bounds of a lineage column only when the column
has no nulls, and otherwise the range `[0, first_row_id + record_count - 1]`
(`[0, sequence number]`), which assumes a stored value is below the
inherited block. Files that store values above it (compaction or
copy-on-write keeping row ids, or other writers) were skipped and their rows
lost: `WHERE _row_id > 1000` on the parquetry `iceberg-row-lineage/materialized`
table returned nothing instead of ids 6 and 8, and the DuckDB
`row_lineage_stored_columns` table (no statistics at all) lost the rows with
stored `_row_id` 100/103 and sequence numbers 7/9.

A file is now pruned by a lineage column only when its manifest declares
bounds for it; when some rows may store NULL the range is the hull of the
declared bounds and the inherited range. Without declared bounds (absent,
undecodable or inverted) the file is not pruned by that column. The early
returns for a missing `first_row_id`, an empty file, a negative sequence
number and a block that does not fit in UInt64 stay as they were.

The new test vendors both tables unmodified, at the paths used by ClickHouse#130017
and ClickHouse#130010.

Closes ClickHouse#130022

Co-Authored-By: Claude Opus 5.5 <[email protected]>
arsenmuk pushed a commit to melvynator/ClickHouse that referenced this pull request Nov 8, 2026
The README carries the provenance and the MIT notice of the copied fixture;
ClickHouse#130010 adds a README at the same path with a superset of this content
(whichever lands second keeps ClickHouse#130010's).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits November 9, 2026 08:31
Conflict in `tests/queries/0_stateless/data_iceberg/duckdb/README.md`: master added the same
DuckDB tables `mapping_failures/map_to_struct` and `row_lineage_stored_columns` (identical files)
with a shorter README. Kept the README of this PR and mentioned the tests of master that use them.
alexey-milovidov and others added 3 commits November 10, 2026 07:32
Address review: the two data files of `lineitem_iceberg` are 1.4 MB and 1.2 MB,
which exceeds the size limit for test data. The table was used only by
`05626_iceberg_duckdb_lineitem_time_travel`; time travel is covered by other
Iceberg tests. The README lists the table among those not included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (794a020). The CI failures are all in the tests this PR adds (05620–05624). They fail with the errors listed in the description (Bad metadata file name, Can not convert empty value, the ata/persistent/... path, a.col1), so this PR is still blocked on the fixes it depends on. As of 2026-11-15 only #130020 is closed. These are still open: #129988 (#130070), #129990 (#130082), #129991 (#130071), #129992 (#130101), #129995 (#117122), #129996, #130002, #130019 (#130173), #130021 (#130117), #128304 (#125439). There are no review comments to address.

@alexey-milovidov
alexey-milovidov marked this pull request as ready for review November 16, 2026 16:41
PedroTadim pushed a commit to hsusul/ClickHouse that referenced this pull request Nov 18, 2026
An Iceberg field added with an `initial-default` must read as that default in
every data file written before it was added (spec, "Column Projection"). The
key was never parsed, so such rows read as NULL, filters on the column missed
them, and a required field added with a default made the table unreadable.

A field absent from a data file is synthesized in two places, and both now use
the default:
- the schema evolution DAG, for a file read under its own older schema: the
  constant of a new top-level field, and `AddingTransform` for a field added
  inside a struct (also inside list elements and map values);
- the format reader, for a file read under the schema that has the field (its
  manifest was rewritten under the newer schema and the old snapshot expired,
  or a stale ClickHouse INSERT): Parquet (top level, struct elements at any
  depth, requested subcolumns), ORC (top level and struct elements) and Avro
  (top level), through a new `ColumnMapper` map of defaults.

The JSON single-value serialization (spec Appendix D) of every type is parsed
once in `IcebergSchemaProcessor`; a malformed default, or a non-null one for a
type that must default to null, fails with ICEBERG_SPECIFICATION_VIOLATION
instead of being ignored. A struct field's own default can only be `{}`, which
stands for the defaults of its fields.

A reader fills a field with its default only when the data file identifies
the fields at that level by field id and none of them has the field's id, the
rule ClickHouse#126879 introduced for Avro: a field missing only by name may be in the
file under another name. With that proof, ORC and Avro no longer read such a
column from a same-named field of the file (a dropped column re-added under
the same name), and ORC builds no search argument for that file, because it
resolves predicate columns by name.

The query condition cache key of UUID-less tables and the Parquet columns cache
identity now include the defaults, since the value read for an absent field
depends on them. A metadata.json schema replaces an identical copy registered
from a manifest header, which does not carry `initial-default`.

The new test reads the Apache Impala and DuckDB Iceberg tables of ClickHouse#130028 and
ClickHouse#130010 (identical files) as written and with their older data files bound to
the newer schema, and ClickHouse-written Parquet, ORC and Avro tables evolved
with nested, required, struct, list and malformed defaults.

Closes ClickHouse#129992

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PedroTadim pushed a commit to hsusul/ClickHouse that referenced this pull request Nov 18, 2026
…tamp defaults

A field whose value comes from an identity partition of the data file must
read as that value, even when it is NULL, before its `initial-default` applies
(spec, "Column Projection"). NULL identity values were skipped, so the reader
filled the default instead; and a struct read as a whole got the defaults of
its nested identity sources. NULL identity values are now applied, and the
per-file column mapper drops the defaults of the file's identity partition
columns (the shared mapper is replaced by the per-file one for such files).

A `timestamp` / `timestamp_ns` default must be an ISO-8601 local date-time and
a `timestamptz` / `timestamptz_ns` default the same with `+00:00`; the lenient
parser accepted any offset (and shifted the value), a missing offset, a space
separator. Other shapes now fail with ICEBERG_SPECIFICATION_VIOLATION.

With `input_format_parquet_allow_missing_columns = 0`, a field proven absent by
field id that has a default is not a missing column (ORC and Avro already
exempt it).

Adds the DuckDB `partition_values_missing_edge_cases/default/mixed` table of
ClickHouse#130010 (identical files); it is not read by a test yet, since its
`final.metadata.json` name is rejected (ClickHouse#129988).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits November 19, 2026 14:13
…ceberg tables

The test came from master together with the tables it shares with this PR.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (30ff53f), which brings in the initial-default fix (#130101, closes #129992). That PR added some of the same DuckDB tables (add_columns_with_defaults*, partition_values_missing_edge_cases/default/mixed) with identical content, so they now come from master. The README now also names 05568_iceberg_initial_default.

I ran the tests locally with a binary built from this master. 05625 passes. 05620–05624 still fail, only on the bugs listed in the description: Bad metadata file name (#129988), POCO_EXCEPTION (#129991, #130002), the ata/persistent/... path (#129990), a.col1 (#128304), the nested identity source (#129995), name mapping (#130019), row lineage (#130021). These issues are all still open, so the PR stays blocked on their fixes. There are no review comments to address.

@clickhouse-gh clickhouse-gh Bot added comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... and removed comp-testing Test content only (no production code). labels Nov 19, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (2160155) without conflicts; the diff of the PR is unchanged. As of 2026-11-22 the CI failures are still only in the tests this PR adds (05620–05624), on the bugs listed in the description. None of the remaining fixes has been merged yet: #130070, #130082, #130071, #117122, #130173, #130117, #125439 are open, and #129996 and #130002 are open issues. So the PR stays blocked on them. There are no unresolved review threads.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master (515c1ba) without conflicts; the diff of the PR is unchanged. As of 2026-11-25 the CI failures are still only in the tests this PR adds (05620–05624), on the bugs listed in the description (Bad metadata file name, POCO_EXCEPTION, and so on). None of the remaining fixes has been merged since the last check: #130070, #130082, #130071, #117122, #130173, #130117, #125439 are open, and #129996 and #130002 are open issues without a fix PR. So the PR stays blocked on them. There are no unresolved review threads.

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

Labels

comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... pr-not-for-changelog This PR should not be mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant