Skip to content

Add Delta Lake tables to the data lake corpus and tests of Delta Lake features - #129100

Merged
alexey-milovidov merged 10 commits into
masterfrom
delta-lake-feature-tests
Nov 7, 2026
Merged

alexey-milovidov merged 10 commits into
masterfrom
delta-lake-feature-tests

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Tests for Delta Lake features that were not tested or barely tested: deletion vectors, the change data feed with deletion vectors and column mapping, type widening, VARIANT, v2 checkpoints with and without sidecars, multi-part checkpoints, row tracking, in-commit timestamps, liquid clustering and domain metadata, icebergCompatV2, writer features (identity, generated and default columns, CHECK constraints), and tables without _last_checkpoint.

Corpus. utils/data-lake-corpus gets a delta kind, mirroring the Iceberg part. It covers 34 tables written by three writers:

  • Spark 4.1.1 with Delta Lake 4.4.1;
  • Spark 3.5.5 with Delta Lake 3.3.2;
  • delta-rs 1.6.6.

Every version of every table is read back by its writer. checks_delta.sql, run by 05560_delta_lake_corpus, compares what ClickHouse reads with that readback:

  • all content, types, count(), single columns and subcolumns, and predicates;
  • every version, through delta_lake_snapshot_version;
  • the change data feed, through delta_lake_snapshot_start_version, against the writer's table_changes.

The corpus adds 4.1 MB of tables and 1.5 MB of expected data.

Tests of ClickHouse behavior on these tables. They are stateless; the S3 test uses s3_conn.

  • 05561: deletion vectors with:
    • count() with and without optimize_count_from_files;
    • filters;
    • the _row_number, _file, _path and _data_lake_snapshot_version virtual columns;
    • tiny blocks;
    • time travel;
    • the DeltaLakeLocal engine;
    • an older writer.
  • 05562: checkpoint discovery without _last_checkpoint, with a stale one, and after log cleanup, for classic, multi-part, and v2 checkpoints.
  • 05563: the change data feed with deletion vectors and column mapping: version ranges, filters, and invalid ranges.
  • 05564: type widening: the types of each version, filters on widened columns (old files keep statistics of the narrow type), and widening of nested fields and partition columns.
  • 05565: file skipping by statistics and partition values, observed through DeltaLakeScannedFiles and DeltaLakePartitionPrunedFiles.
  • 05566: deltaLake, deltaLakeCluster, and the DeltaLake engine over S3, with deletion vectors, sidecars, and the change data feed.
  • 05567: INSERT into tables with features:
    • appends work with deletion vectors, v2 checkpoints, and the change data feed;
    • with row tracking and in-commit timestamps, the commit carries baseRowId, defaultRowCommitVersion, inCommitTimestamp and the high-water mark;
    • type widening, clustering, column mapping, and identity columns are rejected, and those tables stay unchanged.

Bugs found. The references record the current wrong results, so the fixes will update them:

  • With column mapping, the fields of a struct inside an Array or a Map are read as empty or NULL.
  • A subcolumn (st.a, arr.size0) of a partitioned table fails with UNKNOWN_IDENTIFIER when read through delta-kernel-rs.

.gitignore ignores *.bin, so the corpus directory gets an exception for deletion vector files.

05566_delta_lake_s3_deletion_vectors_change_data_feed found duplicated rows of the change data feed with parallel replicas, fixed in #129548.

Related: #129548

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

...

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.1630-master (included in 26.11 and later)

… features

Extend `utils/data-lake-corpus` with a `delta` kind (`delta_gen.py`, `writers/spark_delta_writer.py`,
`writers/deltars_delta_writer.py`): 34 tables written by Spark 4.1.1 with Delta Lake 4.4.1, Spark 3.5.5 with
Delta Lake 3.3.2, and delta-rs 1.6.6. Every version of every table is read back by the writer, and
`checks_delta.sql` (run by `05560_delta_lake_corpus`) compares what ClickHouse reads for each version
(`delta_lake_snapshot_version`) and for the change data feed (`delta_lake_snapshot_start_version`) with the readback.

The tables cover deletion vectors (with checkpoints, column mapping, partitions, MERGE, RESTORE), column mapping in
`id` and `name` modes with renamed and dropped nested columns, schema evolution, type widening (including nested
fields, array elements, map keys and values, and partition columns), v2 checkpoints with JSON and Parquet top-level
files and sidecars, multi-part checkpoints, row tracking, in-commit timestamps, liquid clustering, `icebergCompatV2`,
identity, generated and default columns with CHECK constraints, the change data feed with deletion vectors and column
mapping, partition values with special characters and nulls, and `VARIANT`.

New tests of ClickHouse behavior on top of these tables:
- `05561_delta_lake_deletion_vectors`: count() with and without `optimize_count_from_files`, filters, virtual columns
  (`_row_number`, `_file`, `_path`, `_data_lake_snapshot_version`), tiny blocks, time travel, the table engine.
- `05562_delta_lake_checkpoint_discovery`: no `_last_checkpoint`, a stale one, and a log cleaned up before the newest
  classic, multi-part, or v2 checkpoint.
- `05563_delta_lake_change_data_feed_deletion_vectors_column_mapping`: version ranges, filters, invalid ranges.
- `05564_delta_lake_type_widening`: the types of every version, filters on widened columns, nested widening.
- `05565_delta_lake_data_skipping_profile_events`: file skipping by statistics and partition values
  (`DeltaLakeScannedFiles`, `DeltaLakePartitionPrunedFiles`).
- `05566_delta_lake_s3_deletion_vectors_change_data_feed`: `deltaLake`, `deltaLakeCluster`, and `DeltaLake` over S3.
- `05567_delta_lake_write_into_tables_with_features`: INSERT into tables with deletion vectors, v2 checkpoints, the
  change data feed, row tracking and in-commit timestamps, and rejection of unsupported writer features.

The references record two ClickHouse bugs found by the corpus: with column mapping, the fields of a struct inside
an `Array` or a `Map` are read as empty or NULL, and a subcolumn of a partitioned table fails with `UNKNOWN_IDENTIFIER`.

Deletion vector files (`*.bin`) are ignored by `.gitignore`, so the corpus directory gets an exception.

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

clickhouse-gh Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2c62631]

Summary: ✅


AI Review

Summary

Adds 34 Delta Lake corpus tables from three writer versions, writer readbacks for snapshot and change-feed comparisons, and eight stateless tests covering reading, checkpoints, pruning, and writes. No new actionable findings. Both earlier findings are addressed: appended row IDs are checked against the previous high-water mark, and the tiny-block case now limits the Parquet block size.

Missing context / blind spots
  • ⚠️ CI for head 2c6263107f6f572771f224229179dfd84a1047e1 is still pending. The previous revision’s debug flaky check passed 346 runs across the eight new tests. No local ClickHouse binary was available; latest-head CI must confirm the merged upstream changes.
Final Verdict

✅ Approve — no unresolved review findings; normal CI validation remains pending.

@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Nov 3, 2026
alexey-milovidov and others added 3 commits November 4, 2026 23:21
…pping_profile_events`

The setting is randomized in CI. With it disabled, `p_str = ''` is not rewritten
into `empty(p_str)`, is passed to delta-kernel-rs as a predicate, and the files are
pruned by the scan instead of by ClickHouse, so `DeltaLakeScannedFiles` and
`DeltaLakePartitionPrunedFiles` differ from the reference.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129100&sha=07815e1858894e0a24048f695b00305933d2a03b&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29
#129100

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…gh water mark

In `05567_delta_lake_write_into_tables_with_features`, compare `baseRowId` of the
appended files with `rowIdHighWaterMark` of the previous commit, so reused row ids
are detected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g fix

The column-mapped tables (`column_mapping_id`, `delta332_column_mapping_id`, `iceberg_compat_v2`) are now read
the same as their writers read them, including structs inside arrays and maps and their subcolumns.

Related: #129103

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 2 commits November 6, 2026 07:24
…f `05561_delta_lake_deletion_vectors`

`max_block_size` does not limit the chunks produced by the Parquet reader, so every
corpus file was read as a single chunk and deletion vector offsets across chunks
of the same file were not exercised. Set `input_format_parquet_max_block_size` too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit to groeneai/ClickHouse that referenced this pull request Nov 7, 2026
… table function

With parallel replicas, `deltaLake` and other data lake table functions with a `Cluster` variant were replaced
with it even when reading the change data feed (`delta_lake_snapshot_start_version`,
`delta_lake_snapshot_end_version`). The change data feed is read by `ReadFromDeltaLakeTableChangesStep`,
which does not distribute work between replicas, so every replica returned all changes and each row was
returned once per replica. Do not use parallel replicas for it, as `getStorageForParallelReplicasRead`
already does for tables.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129100&sha=e976b03a34770f15d52f3d8bec00636f8f51d88f&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29
Related: ClickHouse#129100

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov and others added 3 commits November 7, 2026 16:38
…ith `parallel_replicas_for_cluster_engines`

With parallel replicas, `deltaLake` over S3 was converted to `deltaLakeCluster`, but the change data feed
(`delta_lake_snapshot_start_version`) is not split into tasks, so every replica read the whole feed and
`05566_delta_lake_s3_deletion_vectors_change_data_feed` returned each change three times. The `DeltaLake`
table engine already skips its parallel replicas read for the change data feed in
`getStorageForParallelReplicasRead`; do the same for the table function.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129100&sha=6f4ec0fe42fe527afe5f59173cd256dc878bcf83&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29
PR: #129100

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r read with `parallel_replicas_for_cluster_engines`"

This reverts commit 549352d.
@alexey-milovidov alexey-milovidov self-assigned this Nov 7, 2026

@alexey-milovidov alexey-milovidov left a comment

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.

LGTM

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 7, 2026
Merged via the queue into master with commit 1e1d167 Nov 7, 2026
188 checks passed
@alexey-milovidov
alexey-milovidov deleted the delta-lake-feature-tests branch November 7, 2026 21:22
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 7, 2026
@clickhouse-gh clickhouse-gh Bot added comp-delta-lake Delta Lake tables: reading Delta metadata through delta-kernel-rs (table snapshots, schema and ty... 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-delta-lake Delta Lake tables: reading Delta metadata through delta-kernel-rs (table snapshots, schema and ty... pr-not-for-changelog This PR should not be mentioned in the changelog 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.

2 participants