Skip to content

Add tests with the golden Delta tables of delta-kernel-rs - #129093

Merged
alexey-milovidov merged 5 commits into
masterfrom
delta-lake-golden-tables
Nov 6, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
delta-lake-golden-tables

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Add stateless tests that read the golden Delta tables of delta-kernel-rs (kernel/tests/golden_data at commit 88ff5a9 of contrib/delta-kernel-rs, generated by Spark with GoldenTables.scala of delta-io/delta, Apache License 2.0) with deltaLakeLocal and compare the result with the expected data written by Spark. No ClickHouse test used this corpus before. The tables are copied to tests/queries/0_stateless/data_delta_lake/kernel_golden (3.4 MB), because stateless test jobs do not check out build submodules.

The seven tests cover:

  • data types: primitives, arrays, maps, nested structs, dates and timestamps in seven time zones, timestamp_ntz (also with column mapping), INT96, millis and micros timestamps, decimals of every precision, dictionary-encoded decimals with 1M rows;
  • log replay: updates, deletes, merges, restores, classic, multi-part and V2 checkpoints, a corrupted _last_checkpoint, a log of only checkpoints, protocol and metadata changes;
  • filters on every column type with data skipping, compared with the expected data, together with the number of files read (DeltaLakeScannedFiles);
  • deletion vectors with checkpoints and column mapping, including small blocks and disabled Parquet filter pushdown;
  • time travel with delta_lake_snapshot_version over every version (the golden tables are stages of the same table), with schema and partitioning changes, repartitioning and vacuum;
  • invalid tables (missing protocol or metadata, a gap in versions, no _delta_log, files outside of the table directory), which must be rejected.

table-with-columnmapping-mode-id and table-with-columnmapping-mode-name are not included, because ClickHouse reads structs nested in arrays and maps incorrectly under column mapping (an Array(Tuple(...)) column is read as [], a Map(..., Tuple(...)) value as (NULL)); they were added with the fix in #129103.

The generated corpus in tests/queries/0_stateless/data_lake_corpus (Iceberg and Parquet files) uses a different layout of references (JSON produced by pyarrow), while here the references are the Parquet files of Spark and time travel, data skipping and error cases are checked, so the tables are kept next to the other Delta tables in data_delta_lake.

05526_delta_lake_kernel_golden_errors found a hang of the Delta Lake data file iterator with TSan, fixed in #129547.

Related: #129103
Related: #129547

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

Version info

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

Copy the golden tables of delta-kernel-rs (`kernel/tests/golden_data` at commit 88ff5a9 of the
`contrib/delta-kernel-rs` submodule, generated by Spark with `GoldenTables.scala` of delta-io/delta,
Apache License 2.0) to `tests/queries/0_stateless/data_delta_lake/kernel_golden`, and compare what
`deltaLakeLocal` returns with the expected data written by Spark. Stateless test jobs do not check
out build submodules, so the data is copied.

The tests cover data types (primitives, arrays, maps, nested structs, dates and timestamps in
various time zones, `timestamp_ntz`, INT96, decimals of every precision and dictionary encodings),
log replay (updates, deletes, merges, restores, classic, multi-part and V2 checkpoints, a corrupted
`_last_checkpoint`, a log of only checkpoints), filters with data skipping on every column type
(including the number of files read), deletion vectors (with checkpoints, column mapping and small
blocks), time travel with `delta_lake_snapshot_version` over schema and partitioning changes,
repartitioning and vacuum, and invalid tables that must be rejected.

`table-with-columnmapping-mode-id` and `table-with-columnmapping-mode-name` are not included,
because ClickHouse reads structs nested in arrays and maps incorrectly under column mapping.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The root `.gitignore` excludes `*.bin`, so the deletion vector files of the tables were not
committed, and the tests with deletion vectors would fail.

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 [05839df]

Summary: ✅


AI Review

Summary

Adds seven stateless tests using Spark-generated Delta Lake golden tables to check types, decimals, log replay, data skipping, deletion vectors, time travel, and invalid tables. Reviewed all 759 changed files, the current scripts and references, fixture metadata, and all prior discussion at head 05839dffffb087af610418d123deff9e50db9803; local file hashes match the PR. No new inline findings. The previously dismissed large-fixture concern remains below, and merge must wait for the acknowledged iterator fix.

Findings

❌ Blockers

  • tests/queries/0_stateless/data_delta_lake/kernel_golden/README.md:11 [dismissed by author -- https://github.com/Add tests with the golden Delta tables of delta-kernel-rs #129093#discussion_r4460377661] The corpus still commits a 2,303,393-byte Parquet file and 3,466,468 bytes of fixtures overall. The author explicitly accepts this under the repository's existing fixture convention; I retain the concern because the individual dataset exceeds the review skill's 1 MB limit and permanently enlarges full Git clones. Keep the large data in a checksum-pinned test artifact or test image, excluding its blobs from merged Git history. The author-resolved thread remains untouched.
Tests
  • ⚠️ 05526_delta_lake_kernel_golden_errors.sh:47 exposes a known iterator lost wakeup: it timed out after 600 seconds in one of 50 repetitions in the preceding TSan job. All seven tests passed 50 repetitions each in the preceding ARM ASan job. The current TableSnapshot::Iterator::setScanException still changes the wait predicate without next_mutex; PR #129547 remains open. As the author already requested, merge that fix first and verify this test with TSan afterward. The current head CI run is still running and supplies no completed replacement for that evidence yet.
Final Verdict

Status: ❌ Block. Exclude the large fixture blobs from merged Git history, and merge the iterator fix with passing TSan coverage before merging these tests. No new review comments or thread-state changes were posted.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Nov 3, 2026
alexey-milovidov and others added 2 commits November 4, 2026 23:33
`05526_delta_lake_kernel_golden_errors` started `clickhouse-local` for each of the 11 tables and
timed out in the flaky check with TSan, where starting it is slow and the test runs many times in
parallel. Read all tables with `--ignore-error` in one process instead.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129093&sha=e01d39ce69719e92d58eb4e0f7919b7a927c3711&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20flaky%20check%29

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tables `table-with-columnmapping-mode-id` and `table-with-columnmapping-mode-name` were added with
the fix of reading structs inside arrays and maps under column mapping.

Related: #129103

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

Copy link
Copy Markdown
Member Author

🕵 Merged master. The only remaining CI failure is the timeout of 05526_delta_lake_kernel_golden_errors in the TSan jobs (https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129093&sha=1f8839208486532960f6bc3f360565dad2bc0da7&name_0=PR). It is the lost wakeup in the Delta Lake data file iterator that this test found, and #129547 fixes it. That PR is still open, so this PR should be merged after it.

@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.

Ok.

@alexey-milovidov alexey-milovidov self-assigned this Nov 6, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 6, 2026
Merged via the queue into master with commit ee3298e Nov 6, 2026
187 checks passed
@alexey-milovidov
alexey-milovidov deleted the delta-lake-golden-tables branch November 6, 2026 12:57
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 6, 2026
Marouane-elfadli pushed a commit to Marouane-elfadli/ClickHouse that referenced this pull request Nov 7, 2026
`TableSnapshot::Iterator::setScanException` set `scan_exception` and `shutdown` without holding `next_mutex`
and then notified `data_files_cv`. If the notification came after `next` checked the condition of the wait
but before it started waiting, `next` waited forever, and the query hung. This happens when the scanning
thread fails, e.g. with `PATH_ACCESS_DENIED` for a data file outside of the table directory, and it was seen
with TSan. The destructor set `shutdown` in the same way before notifying the scanning thread, which waits
on `schedule_next_batch_cv` with the same condition, so it could hang in `join` as well. Set them under the
mutex. This also makes `next` read `scan_exception` after it is written.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=129093&sha=23927a29eeb17c626ca415713a6eae693f2d74c9&name_0=PR&name_1=Stateless%20tests%20%28amd_tsan%2C%20s3%20storage%2C%20targeted%29
Related: ClickHouse#129093

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-testing Test content only (no production code). 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