Repository navigation
Add Delta Lake write interoperability and concurrency integration tests - #120519
Conversation
|
Workflow [PR], commit [823c9a7] Summary: ✅ AI ReviewSummaryThis PR substantially improves Delta Lake write coverage across Spark/ Findings
Final Verdict
|
| # The same rows with and without stats-based file skipping (Spark must not skip a | ||
| # ClickHouse-written file it should read, nor read one it must not). | ||
| predicate = "id BETWEEN 105 AND 210" | ||
| with_skipping = sorted(r.id for r in spark.sql(f"SELECT id FROM {table} WHERE {predicate}").collect()) |
There was a problem hiding this comment.
with_skipping == without_skipping only proves result correctness. It does not prove that Spark used ClickHouse-written file statistics when skipping was enabled. If those stats become missing or unparsable, both branches can full-scan the table and still satisfy this equality, so the advertised data-skipping coverage disappears.
Please assert some scan-level evidence that skipping actually happened when enabled, for example fewer files read than in the stats.skipping = false branch, or another Spark metric/plan field that records data skipping.
There was a problem hiding this comment.
Not asserting a skipping metric here: ClickHouse currently commits add.stats nested under a stats_json key (#120522), so Spark cannot use the statistics and such an assertion cannot pass today. The equality check stays as the correctness guard; a files-read assertion should be added when #120522 is fixed.
The ClickHouse transaction is opened when the sink is created, so a delta-rs commit during a slow SELECT always makes the ClickHouse commit lose. The interleaved rounds stay as a consistency check. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120519&sha=020e3c9f7a10f5fd3795fd2582b5b31030d81d70&name_0=PR&name_1=Integration%20tests%20(amd_asan_ubsan%2C%20flaky) PR: ClickHouse#120519 Co-Authored-By: Claude Fable 5.1 <[email protected]>
| assert node.query(f"SELECT count(), uniqExact(id), countIf(id >= 100) FROM {fresh}").strip() == "60\t60\t10" | ||
| assert spark.sql(f"SELECT count(*) AS c, count(DISTINCT id) AS d FROM {table}").collect()[0][:] == (60, 60) | ||
| assert len(deltars_rows(deltars_table(started_cluster, "s3", path), "id")) == 60 | ||
| assert_committed_files_exist(started_cluster, path) |
There was a problem hiding this comment.
assert_committed_files_exist only proves that every committed add.path is still present. It does not prove the opposite condition that matters for this checkpoint-boundary race: that the losing ClickHouse write cleaned up its own uncommitted parquet.
If the failed version-3 INSERT leaks one extra ClickHouse data file, every assertion below still goes green because fresh readers use the log, not stray files. Since this is the only checkpoint-snapshot conflict case in the PR, can we also compare list_delta_data_files(started_cluster, "s3", path) against the committed ClickHouse adds (or at least assert there is exactly one ClickHouse parquet after the version-4 retry)?
Spark and delta-rs read back ClickHouse writes (type and partition matrices, MinIO via s3a, Azurite), Spark history/time travel/skipping/checkpoints/VACUUM over ClickHouse commits, concurrent ClickHouse writers and ClickHouse racing delta-rs, read-after-write across nodes, cancel on S3/Azure, credential masking. Also fixes two assertions in test.py and test_azure_cluster.py that could not fail. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…, capture the killed worker's error, cover the unpartitioned sink on object storage Co-Authored-By: Claude Fable 5.1 <[email protected]>
…te the credential-leak check by query_id Co-Authored-By: Claude Fable 5.1 <[email protected]>
Retried on a fresh table up to three times, like the barrier test. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The ClickHouse transaction is opened when the sink is created, so a delta-rs commit during a slow SELECT always makes the ClickHouse commit lose. The interleaved rounds stay as a consistency check. Report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120519&sha=020e3c9f7a10f5fd3795fd2582b5b31030d81d70&name_0=PR&name_1=Integration%20tests%20(amd_asan_ubsan%2C%20flaky) PR: ClickHouse#120519 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…artition-type matrix - The data-file lister deliberately skips `*.snappy.parquet` (files from other writers), so it cannot be compared against every `add.path`; assert instead that the loser left no ClickHouse file and that every committed file of either writer exists. - The partition-type matrix is read back by delta-rs on a twin table without the decimal column, which delta-rs cannot open because of ClickHouse#120521. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The fixed one-second sleep only guessed that the ClickHouse transaction was open. The INSERT now carries a query id and the delta-rs commit waits until `system.processes` shows it has read rows, which happens after the sink (and its kernel transaction) was created; the slow SELECT lasts ten seconds so the delta-rs commit always lands first. Co-Authored-By: Claude Fable 5.1 <[email protected]>
- Barrier race: at least one writer must succeed, not only lose. - ClickHouse vs delta-rs: alternate a one-second head start between the writers, so the schedule makes each side win rounds; both must have committed at least once in the interleaved rounds. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
96a4cf4 to
823c9a7
Compare
`test_storage_iceberg_concurrent/test_concurrent_reads.py::test_concurrent_reads` fails in `Integration tests (arm_binary[, distributed plan], 1/4)` on master since ClickHouse#120519 added `test_storage_delta/test_writes_interop.py`, the second Spark module that reads MinIO through `s3a://root`: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=56e72cfad0e82b5dfd2e3be5202aff91757dc920&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%201%2F4%29 https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=360bb0de656eb8f83cea4ca307f8480348494eb4&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%201%2F4%29 `ResilientSparkSession` reuses a live py4j gateway, so one pytest worker keeps one JVM across modules. Hadoop caches `FileSystem` instances JVM-wide by scheme and authority only, and `SparkSession.stop()` does not clear them, so the iceberg session got the interop module's `S3AFileSystem` for `s3a://root`, still bound to the interop cluster's MinIO, while its own configuration named its own MinIO. In 32 CI jobs carrying both modules, the iceberg test failed 7/7 times when it ran on the same xdist worker after the interop module, and passed 25/25 times on a different worker. In the failed job on 56e72cf, the interop MinIO's released address 172.16.2.4 went to another module's MinIO at 13:56:53Z, Spark's Iceberg metadata write landed there, and ClickHouse's `CREATE TABLE` 6 s later reported Code 107 against its own MinIO. Call `FileSystem.closeAll()` when reusing a live JVM with no active context. The JVM is still reused, so the reuse contract of `test_spark_session_recovery` is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Integration tests for Delta Lake writes where a foreign reader or a second writer is the oracle (
test_storage_delta/test_writes_interop.py):s3aon MinIO) and delta-rs, including Spark partition pruning on the values ClickHouse serializes (the decimal partition column is Spark-only until DeltaLake writes: decimal partition value committed without scale (1.5fordecimal(10,2)), the table is then unreadable by ClickHouse and delta-rs #120521);DESCRIBE HISTORY,VERSION AS OFand data skipping over ClickHouse commits; interleaved Spark/ClickHouse appends; Spark checkpoints around ClickHouse commits, and a ClickHouse commit conflict across a checkpoint boundary;VACUUMkeeps ClickHouse-written live files;KILL QUERYand cancel-in-commit-window on S3 and Azure (only local was covered);query_logortext_log.Also fixes two assertions that could not fail: the object recount in
test_truncatere-counted a pre-computed list, and the row check intest_azure_cluster.pywas a bare expression.Changelog category (leave one):
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/120519]
Version info
26.10.1.2190-master(included in26.10and later)