Repository navigation
Conversation
…ta file A 0-row INSERT behaved differently depending on whether the table was partitioned: an unpartitioned table committed a new transaction log version carrying only commitInfo and referencing no data file, while a partitioned table committed nothing. Every no-op refresh of a scheduled INSERT SELECT therefore grew _delta_log on unpartitioned tables only. Spark creates no version for an append that writes no files. WriteTransaction::commit always calls ffi::add_files + ffi::commit, so committing an empty file list is not a no-op: the kernel appends a commitInfo-only entry. Only DeltaLakePartitionedSink::onFinish guarded that call, on partitions_data.empty(). DeltaLakeSink::onFinish did not, and its data_files stays empty because consume is never reached when the SELECT yields no chunk. This adds the symmetric disjunct. The predicate is data_files.empty() and deliberately not a row count. A written-but-0-row data file must still be committed, or the object stays on storage unreferenced by the log; and returning early with a non-empty data_files would skip the inner finalize loop, leaving each write buffer neither finalized nor cancelled. Skipping the commit leaves no dangling state: the kernel handle stays owned by its wrapper and is freed by ffi::free_transaction, the same uncommitted-transaction path the partitioned sink and the Iceberg writer already take today. Guarding inside WriteTransaction::commit instead would cover both sinks in one place, but it would make a function named commit a silent no-op and foreclose a legitimate future metadata-only commit (a remove-action DELETE, a schema change). The knowledge that an INSERT produced no files belongs to the sink, which is also where both sibling writers keep theirs. Sibling surfaces, measured: the tree has exactly two commit call sites, the unpartitioned sink (fixed here) and the partitioned sink (already held). IcebergStorageSink::finalizeBuffers already applies the same rule via writer_per_partition_key.empty(). The CREATE TABLE initial-log commit always commits by design and is untouched. No new setting and no default change, so no SettingsChangesHistory entry is owed. Existing tables and logs are untouched and no version gaps are created; the removed output was a protocol-valid no-op version that no reader can depend on. New stateless test with 6 arms: 3 are red before this change (both 0-row shapes on an unpartitioned table, and a 0-row INSERT into a table that already holds data), and 3 are unchanged by it, being the partitioned 0-row arm plus both non-empty-INSERT positive controls that prove the guard is not too wide. Every table in the test has the same two columns and takes the same INSERT, so the only difference between the unpartitioned and partitioned arms is partitionColumns. Closes ClickHouse#122020. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review (click to expand)An independent cold review plus a second-model gate ran over this diff: no blocker, no major 💡 Noted, not blocking: the new test's header gives an over-broad reason for hand-writing the Verified by reading rather than asserted: the tree has exactly two |
|
Workflow [PR], commit [13c21b2] Summary: ✅
AI ReviewSummaryThe PR skips transaction-log commits for Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Commit See the job log for details. |
CI finish ledger - f14cb30Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
Nothing is PR-caused. The diff is Gates (a) to (d): 0 of 338 check runs on this head are queued or running. 168 of them belong to the Session id: cron:our-pr-ci-monitor:20260925-040239 |
…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]>
…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]>
|
Dear @SmitaRKulkarni, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A 0-row
INSERTinto an unpartitionedDeltaLaketable no longer commits an empty transaction log version. Both Delta Lake writers now skip the commit when no data file was written, matching the partitioned writer and Spark, so a repeated no-op append (a scheduledINSERT SELECTthat selects no rows, for example) no longer grows_delta_log. Closes #122020.Description
A 0-row
INSERTbehaved differently depending on whether the table was partitioned: an unpartitioned table committed a new version carrying onlycommitInfoand referencing no data file, while a partitioned table committed nothing. Spark creates no version for an append that writes no files.WriteTransaction::commitappends a log version unconditionally, so committing an empty file list is not a no-op. OnlyDeltaLakePartitionedSink::onFinishguarded that call (onpartitions_data.empty());DeltaLakeSink::onFinishdid not, and itsdata_filesstays empty becauseconsumeis never reached when the SELECT yields no chunk. This adds the symmetric disjunctdata_files.empty(). The predicate is the file list and not a row count on purpose: a written-but-0-row data file must still be committed, or the object stays on storage unreferenced by the log.Sibling surfaces, all measured (the tree has exactly two
commitcall sites):INSERTINSERTwriter_per_partition_key.empty()); out of scopeCREATE TABLEinitial logNot a
Bug Fix: no released version does anything wrong, since the empty version is valid per the protocol. The consequence is writer-vs-writer divergence plus log growth on no-op refreshes.New stateless test, 6 arms: 3 red before this change, 3 unchanged by it (the partitioned 0-row arm and both non-empty-
INSERTpositive controls, which prove the guard is not too wide); 100/100 randomized runs.Workflow [PR]
Sync PR [sync-upstream/pr/122092]