Skip to content

Add stateless tests for Delta Lake writes - #120518

Open
zlareb1 wants to merge 27 commits into
ClickHouse:masterfrom
zlareb1:delta-lake-writes-stateless-coverage
Open

zlareb1 wants to merge 27 commits into
ClickHouse:masterfrom
zlareb1:delta-lake-writes-stateless-coverage

Conversation

@zlareb1

@zlareb1 zlareb1 commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Stateless tests for Delta Lake writes (allow_delta_lake_writes), on hand-bootstrapped DeltaLakeLocal tables:

  • 05223: setting gate (compiled default off, alias, SET, SETTINGS clause, read-only); nothing is written when rejected.
  • 05224: non-append statements and rejected inserts fail closed: no new version, no data file, rows intact.
  • 05225: shape of committed _delta_log entries (version naming, one action per line, relative add.path, size, partitionValues, dataChange); duplicate and 0-row inserts.
  • 05226: delta_lake_insert_max_rows_in_data_file and the previously untested delta_lake_insert_max_bytes_in_data_file.
  • 05227: accurate-cast matrix over Delta primitive types.
  • 05228: writes through regular and refreshable materialized views.
  • 05229: async_insert into a Delta table.
  • 05230: memory and execution-time limits mid-write fail closed; 1000-partition insert bounded.
  • 05231: profile constraint kill switch (allow_delta_lake_writes = 0 READONLY) holds against SET, the alias and a SETTINGS clause; readonly = 1 and readonly = 2 users cannot write.
  • 05232: source types without a Delta counterpart (UInt64, Int128, UUID, Enum, IPv4, LowCardinality, JSON, Variant, Dynamic, Map, ...) through accurateCast on INSERT: what is stored, what is rejected.
  • 05233: system.query_log accounting of committed, rejected and failed Delta INSERTs.
  • tests/performance/delta_lake_write.xml: one large commit and many small commits into DeltaLakeLocal.

allow_delta_lake_writes is enabled in the functional-test profile so every tested INSERT into a DeltaLake table reaches the writer (the fuzzer profile already enables it).

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

@clickhouse-gh

clickhouse-gh Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [39c21ce]

Summary: ✅


AI Review

Summary

This PR adds a broad stateless/performance test suite for DeltaLakeLocal writes and flips the functional-test default profile so server-side Delta writes reach the writer. The coverage jump is valuable, but one newly added case still does not verify the contract it advertises, and two previously discussed coverage gaps remain real in the current code.

Findings

⚠️ Majors

  • [tests/queries/0_stateless/05226_deltalake_writes_data_file_limits.sh:115] The zero-limit case only asserts BAD_ARGUMENTS. It never checks that the table state stays unchanged, so a regression that validates delta_lake_insert_max_rows_in_data_file = 0 / delta_lake_insert_max_bytes_in_data_file = 0 only after opening a writer or creating a new version would still pass here. Suggested fix: re-run report/versions after each rejected insert, or run the two zero-limit cases against a fresh table and assert no new version or *.parquet file appears.
  • [tests/queries/0_stateless/05230_deltalake_writes_resource_limits.sh:64] [dismissed by author -- https://github.com/Add stateless tests for Delta Lake writes #120518#discussion_r4039823229] The “bounded memory” case still is not observable enough to protect the invariant it names. 2000 tiny rows with max_memory_usage = 4000000000 leave so much headroom that a substantial per-partition regression would still stay green, so this reads more like a smoke test than a memory-bound guarantee. Suggested fix: either tighten the observable pass/fail condition, or weaken the claim here and move the real memory bound to a dedicated perf-style check.
  • [tests/queries/0_stateless/05227_deltalake_writes_accurate_cast_matrix.sh:35] [dismissed by author -- https://github.com/Add stateless tests for Delta Lake writes #120518#discussion_r4045755845] The rejection matrix still never drives the Delta decimal(9,2) accurate-cast failure path. There are overflow cases once the scaled value exceeds the backing Decimal32 range (for example above 21474836.47), so the decimal fail-close branch remains unpinned even though the banner says non-fitting values are rejected. Suggested fix: add one such Decimal(18,2) row to the rejection matrix and keep the existing state check.
Final Verdict

⚠️ Needs changes before merge: please fix the new zero-limit false positive, and I would also revisit the two dismissed coverage gaps above.

Comment thread tests/config/install.sh Resolved
zlareb1 and others added 24 commits October 12, 2026 10:46
Every INSERT into a DeltaLake table in functional tests and fuzzers now reaches
the writer. The gate tests set the setting off explicitly and pin the compiled
default via system.settings.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… 05230 (style check forbids 'fail' in test names)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…time budget); 05229: accept one or two async flushes

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…e so previous-release jobs (older than 26.7) keep booting

Co-Authored-By: Claude Fable 5.1 <[email protected]>
… keeps the session's writes setting

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Nothing is committed at flush time. The INSERT itself is still acknowledged:
ClickHouse#120717

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…as lane

Pin the refresh definitions to enable_parallel_replicas = 0 instead of skipping the test:
ClickHouse#120714

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Master already enables the setting there through its alias allow_experimental_delta_lake_writes.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ive MV and async insert cases

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ource-type tests

- 05225: assert the committed `partitionValues` and the directory of every data file, including a NULL partition.
- 05226: print the rows of every file per partition, so a byte budget shared across partitions is caught.
- 05231: profile constraint kill switch (`allow_delta_lake_writes = 0 READONLY`) against SET, the alias and a SETTINGS clause; `readonly = 1` and `readonly = 2` users.
- 05232: source types without a Delta counterpart (UInt64, Int128, UInt256, UUID, Enum, IPv4/IPv6, LowCardinality, FixedString, Date, DateTime64, Bool, JSON, Variant, Dynamic, Nullable, Decimal, Map) through `accurateCast` on INSERT.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The flaky-check lane under ASan timed out (> 180 s): the test started one `clickhouse-local` per data
file to count rows, about sixty process starts. Each report now reads every data file of the table with
one `file('**/*.parquet')` query and derives the per-file and per-partition row counts from it.

CI: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120518&sha=892cd2ad12c8a1a3ef11e59ccb4d2e93ff54ea52&name_0=PR&name_1=Stateless%20tests%20(amd_asan_ubsan%2C%20flaky%20check)

Co-Authored-By: Claude Fable 5.1 <[email protected]>
`allow_delta_kernel_rs = 0` is deprecated (ClickHouse#122021), so
the error text of the legacy path is not a contract worth pinning.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…w commit to its fix

- 05227: a Delta `boolean` column fed from an `Int32` source: 0 and 1 round-trip, every other value is stored as `true` with and without the accurate cast (`accurateCast` to `Bool` accepts every value, so no rejection exists to pin).
- 05225: the unpartitioned 0-row INSERT case is dropped; ClickHouse#122092 changes that behaviour and carries its own test. The partitioned case (no version) stays.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ow case

- 05223: after `INSERT ... SETTINGS allow_delta_lake_writes = 1`, a second INSERT of the same session without the clause is rejected again and nothing is written.
- 05232: a `UInt256` value above `Int64` max is rejected with `CANNOT_CONVERT_TYPE`.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The `wr_small` case measured a single 1000-row `INSERT`, so each sample was
one short commit: too short to be stable in perf CI and blind to costs that
only show up after repeated commit-log updates. Reuse
`write_small_commits.sql`, as `iceberg_suite_write.xml` does, so each sample
times five tiny commits against `{database}.wr_small`.

Review comment: ClickHouse#120518 (comment)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zlareb1
zlareb1 force-pushed the delta-lake-writes-stateless-coverage branch from 0e24fe1 to 64c8c31 Compare October 12, 2026 05:18
@zlareb1
zlareb1 marked this pull request as ready for review October 12, 2026 06:39
"
report "${ROOT}/both" 0

echo "-- a zero limit is rejected up front"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only checks that the query returns BAD_ARGUMENTS; it does not verify the promised “rejected up front” contract. Because ${ROOT}/both already contains a successful commit, a regression that validates delta_lake_insert_max_*_in_data_file = 0 only after opening a writer or emitting a new version/file would still leave this test green.

Please re-check the table state after each zero-limit attempt (or run them against a fresh table) so this case pins failure-before-write, not just the error code.

@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 19, 2026

This branch has not been deployed

No deployments
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant