Repository navigation
Adapt two Delta Lake integration tests to Spark 4.0 - #125456
Conversation
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]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261012-155900 |
|
Workflow [PR], commit [f23619d] Summary: ✅ AI ReviewSummaryThis PR adapts two Delta Lake integration tests to Spark 4.0 semantics without changing the production code path: the nested Final Verdict
|
Related: #117198
Related: #120519
Related: #120863
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required.
Description
Since #117198 moved the integration runner to Spark 4.0 and delta-spark 4.0, two tests merged after its last CI run fail on every master commit, in every job that runs them (amd_tsan 1/8 on 188290ba). Each one used Spark behaviour that changed in 4.0 as its oracle:
test.py::test_writes_timestamp_ntz_annotation_nestedexpected Spark to refuse reading a UTC-adjusted Parquet timestamp intotimestamp_ntz. Spark 4.0 reads it without a shift (SPARK-47447), sopytest.raisesfails withDID NOT RAISE. I removed that Spark check and three comments that present a Spark read as the oracle. The pyarrow asserts on the written file still check that the ambiguoussc.a.bpath keeps the default annotation.test_writes_interop.py::test_write_to_table_with_unsupported_writer_feature_is_rejectedused Change Data Feed to make the table unsupported for writes. delta-spark 4.0 gives such a table protocol(1,7)with thechangeDataFeed,invariantsandappendOnlyfeatures, which delta-kernel supports for writes, so the INSERT succeeds (correctly:table_changesreturns the new rows as inserts). The test now adds a CHECK constraint instead. That gives protocol(1,3)on both Spark versions, and the kernel rejects it withFeature 'checkConstraints' is not supported, which the test now asserts. The intent is unchanged: the write fails closed and leaves the table as Spark left it.Validation, run locally with the CI runner images' jars: both tests fail on master with the CI errors on Spark 4.0 and pass with this change on Spark 4.0 and on Spark 3.5. On Spark 4.0 they passed 5 times in a row, together with the sibling
timestamp_ntztests.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125456]
Version info
26.10.1.2237-master(included in26.10and later)