Skip to content

Adapt two Delta Lake integration tests to Spark 4.0 - #125456

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-delta-tests-spark-4
Oct 12, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-delta-tests-spark-4

Conversation

@groeneai

@groeneai groeneai commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #117198
Related: #120519
Related: #120863

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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_nested expected Spark to refuse reading a UTC-adjusted Parquet timestamp into timestamp_ntz. Spark 4.0 reads it without a shift (SPARK-47447), so pytest.raises fails with DID 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 ambiguous sc.a.b path keeps the default annotation.
  • test_writes_interop.py::test_write_to_table_with_unsupported_writer_feature_is_rejected used Change Data Feed to make the table unsupported for writes. delta-spark 4.0 gives such a table protocol (1,7) with the changeDataFeed, invariants and appendOnly features, which delta-kernel supports for writes, so the INSERT succeeds (correctly: table_changes returns 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 with Feature '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_ntz tests.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.2237-master (included in 26.10 and later)

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]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Oct 12, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
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).

# Sev Finding Verdict Evidence / action
1 💡 After the change no test covers a ClickHouse INSERT into a CDF-enabled table, which delta 4.0 tables now allow noted, not blocking Verified locally: the commit has only add actions and table_changes returns the rows as inserts. Positive CDF-write coverage is out of scope for this test fix.

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20261012-155900

@groeneai

Copy link
Copy Markdown
Collaborator Author

#117198 is being reverted in #125455. Both tests pass with this change on Spark 3.5 and on Spark 4.0, so it is still needed for the re-land of #117198.

@clickhouse-gh

clickhouse-gh Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f23619d]

Summary: ✅


AI Review

Summary

This PR adapts two Delta Lake integration tests to Spark 4.0 semantics without changing the production code path: the nested timestamp_ntz test now relies on the written Parquet schema instead of an outdated Spark read failure, and the unsupported-writer-feature test now uses a CHECK constraint that still exercises the same fail-closed write path on both Spark 3.5 and 4.0. I reviewed the current diff, surrounding test logic, prior discussion, and the all-green CI, and I do not see a correctness or coverage regression in the updated test oracles.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 12, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 12, 2026
@fm4v
fm4v added this pull request to the merge queue Oct 12, 2026
Merged via the queue into ClickHouse:master with commit 80e3849 Oct 12, 2026
177 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-delta-lake Delta Lake tables: reading Delta metadata through delta-kernel-rs (table snapshots, schema and ty... groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-ci 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.

4 participants