Skip to content

Write Delta timestamp_ntz columns as unadjusted Parquet timestamps - #120863

Merged
alexey-milovidov merged 11 commits into
ClickHouse:masterfrom
groeneai:delta-timestamp-ntz-parquet-annotation
Oct 12, 2026
Merged

alexey-milovidov merged 11 commits into
ClickHouse:masterfrom
groeneai:delta-timestamp-ntz-parquet-annotation

Conversation

@groeneai

@groeneai groeneai commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed INSERT into a DeltaLake table with a timestamp_ntz column writing the Parquet data file with isAdjustedToUTC=true, which made the committed table unreadable by Spark and other Delta engines. Such a column is now annotated TIMESTAMP(isAdjustedToUTC=false), as the Delta protocol requires. Closes #120653.

Description

An INSERT into a Delta table whose schema declares a timestamp_ntz column succeeded and committed, but stored the column as INT64 / Timestamp(isAdjustedToUTC=true, MICROS). Delta defines timestamp_ntz as an unadjusted (wall clock) Parquet timestamp, so every later Spark read of the table failed:

java.lang.RuntimeException: Unable to create Parquet converter for data type
    "timestamp_ntz" whose Parquet type is int64 time(TIMESTAMP(MICROS,true))

ClickHouse itself still read the table, so the damage was interop-only.

Root cause: the kernel schema visitor wired visit_timestamp and visit_timestamp_ntz to the same visitor, so both Delta types arrived as DateTime64(6) and the distinction was gone before the writer saw it. The Parquet writer then hardcoded isAdjustedToUTC=true, correct for plain Parquet (a DateTime64 is an instant) but wrong for a Delta timestamp_ntz column.

The fix keeps the distinction on the schema visitor's field, caches the dotted paths of the timestamp_ntz leaves with the rest of the snapshot schema, and passes them to the Parquet writer through ColumnMapper, the channel that already carries per-path lake facts that the ClickHouse type cannot express. Only the annotation changes; the stored int64 is identical, so the ClickHouse round trip stays lossless. This is the exact inverse of the read-side rule settled in #87872.

Nothing else is affected: general-format Parquet writes, Iceberg writes, Delta tables with no timestamp_ntz column, Delta writes in a non-Parquet format, a timestamp_ntz leaf whose dotted name collides with a timestamp leaf, and an INSERT pinned to an older snapshot version all keep their current behaviour. Existing data files are not rewritten, so old tables are not repaired.

#118601 adds the same seam for Iceberg. The PrepareForWrite hunks are identical, but it names the ColumnMapper accessor isIcebergLocalTimestampPath, so whichever lands first, the other should reuse the surviving accessor instead of adding a second one.


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

Version info

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

groeneai and others added 6 commits September 18, 2026 07:56
An INSERT into a Delta table whose schema declares a timestamp_ntz column
committed a data file that annotated the column
Timestamp(isAdjustedToUTC=true, MICROS). Delta defines timestamp_ntz as an
unadjusted wall clock timestamp, so Spark refused every later read of the
table with

  java.lang.RuntimeException: Unable to create Parquet converter for data
  type "timestamp_ntz" whose Parquet type is int64 time(TIMESTAMP(MICROS,true))

Two independent facts produced this. The kernel schema visitor wired
visit_timestamp and visit_timestamp_ntz to the same visitor, so both Delta
types became DateTime64(6) and the distinction was gone before the writer saw
it; ClickHouse has no wall clock type that could carry it either. The Parquet
writer then hardcoded isAdjustedToUTC=true at both timestamp branches, which
is right for the general Parquet format because a DateTime64 is an instant,
but wrong for a column the Delta log declares timestamp_ntz.

Rather than consult the DateTime64 timezone parameter, which would change
every general-format write and contradict the rule settled in ClickHouse#87872, the
distinction is kept where it is produced and delivered where it is needed.
The visitor records is_timestamp_ntz on its field, the traversal collects the
dotted paths of those leaves, TableSnapshot caches them with the rest of the
schema, and the Delta write path hands them to the writer through
ColumnMapper, which already carries per-path lake facts that a ClickHouse
type cannot express (iceberg_string_paths, iceberg_optional_paths).

Nested paths are spelled the way the Parquet writer spells a column path (a
struct field's own name, element for an array child, key and value for a
map's) rather than reusing the kernel's child names, which are not guaranteed
to be those words.

Only the annotation changes; the stored int64 is identical, so the ClickHouse
round trip stays lossless. This is the inverse of the documented read-side
rule that reads an unadjusted timestamp as DateTime64(N, 'UTC').

The mapper is attached only when the table actually has a timestamp_ntz
column and only for Parquet, so a Delta table without one keeps its exact
current behaviour, and ORC and Avro never see a mapper they would read as
Iceberg metadata. ParquetBlockOutputFormat now passes std::nullopt when the
mapper's field-id map is empty: an engaged but empty optional makes
convertSchema report the first column as having no Iceberg field id, so a
mapper carrying only timestamp paths would otherwise break every Delta
INSERT. An Iceberg mapper always has an id per field, so Iceberg is
unaffected.

The shared annotation seam is shaped identically to the in-flight ClickHouse#118601,
which adds it for Iceberg but does nothing for Delta, so either merge order
is a mechanical rebase.

Tests: two integration tests in test_storage_delta covering the flat case
(with Nullable, a Delta timestamp control and a char/varchar column) and the
nested case (struct field, array element, map value, plus a Delta timestamp
sibling inside the same struct), both asserting the _delta_log types first so
they cannot pass vacuously, the written annotation, a Spark read and the
ClickHouse round trip. 02735_parquet_encoder gains a logical_type assertion
because desc file() reports DateTime64(N, 'UTC') for both flag values, so
nothing on master would have caught a global flip of the default.

Closes ClickHouse#120653.
A Delta field name may contain a dot, and such a table is writable today: the
write path rejects column mapping, not dotted names, and the read side is
already tested on that shape. So a struct like

  sc STRUCT<`a.b`: timestamp_ntz, a: STRUCT<b: timestamp>>

flattens both of its leaves onto the writer path sc.a.b, and annotating from
that path gave the Delta timestamp leaf isAdjustedToUTC=false, which is the
same contradiction between data file and Delta log that this branch fixes for
timestamp_ntz, only in the other direction.

The traversal now also records the writer path of every field that is not a
timestamp_ntz leaf, and subtracts that set once the whole tree is known. A
path claimed by two fields therefore selects nothing and keeps the default
annotation, which is never wrong for a Delta timestamp column and leaves the
reported bug unfixed only for a table whose field names contain dots. The
alternative, an escaped or otherwise injective path spelling, would have to
change the Nested::concatenateName paths that iceberg_optional_paths,
iceberg_string_paths and column_field_ids already share, i.e. alter Iceberg
write behaviour to serve a pathological Delta schema.

Take the annotation from the transaction, not the snapshot

The paths were read from the snapshot, which is a cache lookup and can be
pinned outright with delta_lake_snapshot_version, while an unpartitioned write
shapes its data file with the schema of the transaction, which the kernel
always opens on the latest snapshot. validateSchema compares column names
only, and everything else in the write path re-derives itself from that fresh
write schema; the timestamp_ntz bit was the one fact that could not self-heal,
because both Delta types collapse to DateTime64(6). getWriteSchema (one
caller) now returns the paths beside the schema it visited, and
WriteTransaction mirrors write_schema's provenance exactly: the transaction's
own write context when unpartitioned, the snapshot set passed at construction
when partitioned, which is the branch that already uses the table schema.

Give the partitioned sink an oracle

Both new tests created unpartitioned tables, so DeltaLakePartitionedSink's
plumbing could be reverted to nullptr with the suite green while a partitioned
Delta table kept committing isAdjustedToUTC=true. The flat test is now
partitioned on id and the nested one stays unpartitioned, so each sink is
covered by a test that exists, and the two annotation provenances above are
exercised once each. The nested test carries the dotted-name collision and
reads that column in its own Spark projection, because a column annotated as
on master is exactly what Spark cannot convert.

Co-Authored-By: Claude Opus 5 <[email protected]>
A Delta field name may contain a dot, so two fields can flatten to the same
Parquet writer path. The guard that keeps such a path unannotated recorded the
path of every non-timestamp_ntz field, containers included. But the annotation
is looked up in preparePrimitiveColumn only, so a struct, array or map GROUP
that lands on a leaf's path never performs a lookup and is not a competing
claim; pruning on it threw away a correct annotation and left the reported
interop defect unfixed for STRUCT<`a.b`: timestamp_ntz, a: STRUCT<b: STRUCT<..>>>,
a shape the suite already exercises for dotted names without column mapping.
Only a leaf now records a claim, which is what the member's own comment says.

Also, for a partitioned table the write schema and these paths come from the
snapshot, while the transaction always commits against the latest version
(delta-kernel-rs exposes no partitioned write context over FFI). With
delta_lake_snapshot_version pinned, the snapshot can declare a column that the
current schema declares `timestamp`, so annotating from it would write
isAdjustedToUTC=false into a table declaring an instant: a new way to produce
exactly the unreadable table this change exists to prevent. A pinned snapshot
therefore annotates nothing and the file is written as before. Measured first
that such an INSERT is accepted rather than rejected, so the case is reachable.

The nested test gains the leaf-versus-group column and the partitioned test a
pinned second INSERT; each has a build with only its own hunk reverted in which
only its own assertion fails. A test comment claiming a Nullable versus
non-Nullable writer-path pair was wrong and now states what the pair proves:
the write header replaces both columns with the Delta schema's nullable type,
so both ClickHouse declarations end up annotated.
…tted

The timestamp_ntz annotation was skipped for every INSERT that pinned
delta_lake_snapshot_version, not just for one whose pinned schema differs
from the current one. A write pinned to the version the transaction commits
against is not skewed, so that discarded a correct annotation and committed
exactly the data file this fix exists to prevent: int64 micros annotated
isAdjustedToUTC=true under a Delta schema declaring timestamp_ntz, which
Spark refuses to convert.

The transaction always commits against the latest table version, so the
predicate now compares the pinned version against a freshly loaded latest
snapshot and annotates only when they are equal; an older pin keeps the
previous behaviour. The latest snapshot is constructed directly rather than
through getTableSnapshot(std::nullopt), which falls back to the cached
latest_snapshot_version that update() deliberately does not refresh for a
pinned query -- the written annotation would otherwise depend on session
history. The extra load introduces no new failure mode, because
WriteTransaction::create() already has the kernel open the table at its
latest version.

The partitioned test's pinned leg now asserts the annotation and reads the
whole table back through Spark, proving the file is conforming and not
merely annotated; a second leg pins an older version and asserts the
unchanged UTC-adjusted default. Two negative controls pin the predicate:
removing the guard reddens the older-pin leg, and restoring the previous
coarse form reddens the current-pin leg.
Delete comments that narrate this change (what a caller passes, why a guard is here, refuted alternatives) and shorten the rest; keep the property comments a reader cannot derive from the code.
Drop pointer comments duplicated at the definition site and shorten the survivors.
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Sep 18, 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; 4 review rounds, 13 findings across my own
cold passes and the gate; bounded: 1 full pass + fix rounds + delta rechecks).

# Sev Finding Verdict Evidence / action
1 ❌ r1: a Delta field name may contain a dot, so two leaves can flatten onto one Parquet path; annotating from that path would give a Delta timestamp leaf an unadjusted annotation AGREE Fixed by pruning ambiguous paths in the producer (fail open), not by changing the path spelling shared with the Iceberg field-id and optionality maps
2 ❌ r1: the annotation came from a snapshot while the write schema came from the transaction, and the two can disagree; ClickHouse types cannot self-heal it because both Delta timestamp types are DateTime64(6) AGREE Fixed by giving the annotation the write schema's provenance in both branches of the transaction (the kernel's write context when unpartitioned, the snapshot's set otherwise)
3 ❌ r2: that prune recorded every field's path, containers included, but only a primitive path is ever looked up, so a struct flattening onto a leaf's path silently discarded a correct annotation AGREE isLocalTimestamp has one call site, in preparePrimitiveColumn. Fixed by keying the claim on leaf paths only, with a leaf-versus-group fixture and a negative control that reddens without the change
4 ❌ r3: the resulting pinned-snapshot guard suppressed the annotation for every delta_lake_snapshot_version write, including one pinned to the latest version, where there is no skew; the test asserted that as correct AGREE Fixed: the pin is now proven current against a freshly loaded latest snapshot before the annotation applies, with a live test leg and a negative control per branch
5 ❌ r4: the latest-version check is not race-free, so a concurrent schema-replacing overwrite could still attach a stale annotation to a transaction committing against a newer schema DISAGREE For a partitioned table the write schema is that same snapshot's schema, because the kernel exposes no partitioned write context (TODO(#2355)), so the annotation is not separable from the schema it annotates. The named remedy is unavailable for an uncommitted transaction (the FFI reports a transaction's version only post-commit) and where it is available it is already used: the unpartitioned branch takes its paths from the transaction's own write context. See the limitation noted below
6 ⚠️ r2: the partitioned test claimed a Nullable/non-Nullable writer-path pair that does not exist, because the Delta write schema overrides the ClickHouse declaration AGREE Measured in the written footer: no field of the fixture is non-nullable. The comment now states what the pair actually proves, both columns kept
7 ⚠️ r1: the partitioned sink's plumbing had no oracle, so its hunks could be reverted with the suite green AGREE The flat test is now partitioned and the nested one unpartitioned, so both sinks and both provenance branches are covered without a third test
8 💡 r4: a pinned INSERT loads the latest snapshot even when the result is discarded (the unpartitioned branch replaces the path set from its own write context) AGREE, not blocking Correct, and I raised it independently. It is one redundant metadata load on a pinned INSERT, no behaviour difference; restricting the probe to partitioned writes would remove it
9 💡 The DateTime/MILLIS arm consults the same fact as the DateTime64 arm, but no current writer can reach it AGREE, kept Delta maps both timestamp types to DateTime64(6), and the Iceberg producer that would reach it is unmerged. Kept for uniformity; an unreachable arm cannot be given a live test
10 💡 r4: the legacy TIMESTAMP_MICROS converted type is still written beside isAdjustedToUTC=false, which arrow's own writer suppresses DISAGREE parquet.thrift sanctions the pair verbatim ("use ConvertedType TIMESTAMP_MICROS for TIMESTAMP(isAdjustedToUTC = *, unit = MICROS)"), parquet-mr's comparison treats it as matching, and the test's Spark read is the empirical proof
11 💡 r4: #118601 adds the same seam with an iceberg_-prefixed ColumnMapper accessor, so a naive merge would leave two sets for one concept AGREE I kept the format-neutral name (the concept is not Iceberg-specific) and named the divergence in the description instead, so the merge order can be decided deliberately
12 💡 The nested test pins a Spark-version-specific message for the shape that deliberately stays unannotated DISAGREE It is the reported defect's own message; matching any exception would pass on an unrelated Spark failure, so the narrow match is the stronger oracle
13 💡 The leaf prune could be narrower still: only a timestamp-typed leaf can consult the annotation, so a colliding Int32 leaf need not suppress it DISAGREE That shape keeps the pre-fix behaviour today, so there is no regression to fix, and the limitation is stated in the description

Known limitation, stated rather than fixed (finding 5). For a partitioned table the data file is
written against the snapshot's schema (delta-kernel exposes no partitioned write context via FFI,
TODO(#2355)) and the annotation comes from that same snapshot, so the two cannot disagree with each
other; if another engine replaces the table schema between that read and the commit, both are stale
together, exactly as on master. The one sub-case where this PR is worse than master is a concurrent
overwrite changing only a column's timestamp_ntz/timestamp-ness: both are int64 micros, so the
annotation is then the sole non-conforming thing. Closing that means basing the write transaction on the
caller's snapshot (transaction_with_committer), which changes commit and conflict semantics for every
Delta write. That is an owner call, so I am reporting it rather than guessing at it.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per
finding. Findings on hunks unchanged by a fix round are auto-dropped.

Session id: cron:clickhouse-review-slot-9:20260918-145000

@clickhouse-gh clickhouse-gh Bot closed this Sep 18, 2026
@clickhouse-gh clickhouse-gh Bot reopened this Sep 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. One integration test command fails on every run on the unpatched binary; no randomization involved.
b Root cause explained? Yes. visit_timestamp and visit_timestamp_ntz were wired to the same schema visitor, so both Delta types became DateTime64(6) before the writer saw them; the Parquet writer then hardcoded isAdjustedToUTC=true.
c Fix matches root cause? Yes. The distinction is preserved where it is produced and consumed where it is used, through ColumnMapper, which already carries per-path lake facts the ClickHouse type cannot express. No widened bound, no guard, no suppression.
d Test intent preserved / new tests added? Yes. Two new integration tests (flat and nested) plus a default-behaviour guard in 02735_parquet_encoder; no existing assertion weakened. Every branch of the fix has a leg with its own negative control: reverting just that branch reddens just that assertion.
e Both directions demonstrated? Yes. Same command, two binaries: unpatched writes timestamp[us, tz=UTC] and Spark fails with the reported Unable to create Parquet converter ... "timestamp_ntz"; patched writes timestamp[us] and Spark reads the table.
f Fix is general across code paths? Yes. Both writer timestamp branches (DateTime, DateTime64) and both Delta sinks are covered, each with its own test: the flat test is partitioned (DeltaLakePartitionedSink), the nested one is not (DeltaLakeSink), which also exercises both annotation-provenance branches (table schema vs the transaction's write schema). Fixed at the schema boundary, not at the annotation site.
g Fix generalizes across inputs (params/datatypes/wrappers)? Measured: Nullable(DateTime64(6)) behaves like DateTime64(6); struct field, array element and map value all annotated correctly; a Delta timestamp sibling inside the same struct stays adjusted; a table with no timestamp_ntz column attaches no mapper at all; two leaves of different Delta types flattening to one Parquet path both keep the default annotation, while a timestamp_ntz leaf colliding with a struct keeps its own; an INSERT pinning delta_lake_snapshot_version to the version it commits against is annotated, one pinned to an older version is not.
h Backward compatible? (maintainer-approved exception only) Yes. No setting added and no default changed, so no SettingsChangesHistory.cpp entry. Files written by older versions are not rewritten; this does not repair existing tables.
i Invariants and contracts preserved? Yes. physical_names_map key construction is untouched (the writer path is a separate parameter). Annotation paths share the write schema's provenance, and a pinned snapshot is used only when its version is measured to be the latest one, so no file is annotated against a schema it was not written for. The empty-field-id guard is required: an engaged-but-empty encoding map makes convertSchema reject the first column, which would break every Delta INSERT; Iceberg is unaffected, an Iceberg mapper always has an id per field (10 passing Iceberg write tests). ORC and Avro are gated out.

Validation: 2 new integration tests x 5 consecutive runs (10/10), 02735_parquet_encoder 50/50 randomized runs, 10/10 Iceberg write tests, 39/40 DeltaLake stateless tests (the 1 failure is a missing local S3 rig and reproduces identically on the unpatched binary). Both new tests fail on the unpatched binary, and each part of the fix has a build with only that part reverted in which only its own assertion fails; the snapshot-pinning predicate has a control per direction.

Session id: cron:clickhouse-impl-slot-6:20260918-141000

@clickhouse-gh

clickhouse-gh Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [bf63649]

Summary: ✅


AI Review

Summary

This PR carries Delta timestamp_ntz / local-timestamp information from the Delta schema into Parquet writes so new Delta files use isAdjustedToUTC=false where required, and the added flat/nested/path-collision coverage looks strong. I still do not think the partitioned-write path is safe to merge: it can commit a file annotated from an older snapshot after ffi::transaction has already moved to a newer schema, which reintroduces the exact Spark-unreadable Delta files this PR is trying to eliminate.

Findings

❌ Blockers

  • [src/Storages/ObjectStorage/DataLakes/DeltaLakeMetadataDeltaKernel.cpp:801-816, src/Storages/ObjectStorage/DataLakes/DeltaLake/WriteTransaction.cpp:204-209, tests/integration/test_storage_delta/test.py:6757-6783] [dismissed by author -- https://github.com/Write Delta timestamp_ntz columns as unadjusted Parquet timestamps #120863#discussion_r4048502329] On the partitioned path, the timestamp_ntz writer-path set and the cast schema still come from snapshot->getTableSchema() / snapshot->getTimestampNtzPaths() before ffi::transaction opens the real Delta transaction. A concurrent overwrite that lands in that window can change only a column's timestamp_ntz vs timestamp semantics, so the transaction commits against the newer schema while the Parquet footer is still annotated from the older one; Spark then rejects the new file again. The new stale-pin test currently codifies that broken outcome instead of catching it.
    Suggested fix: only emit the unadjusted annotation when the partitioned write can prove it is using the transaction's actual base snapshot (for example via a partitioned write context / transaction-base version from the FFI); otherwise fail closed or keep the old adjusted annotation rather than committing a contradictory footer.
Final Verdict

Request changes — the partitioned Delta write path still has a correctness hole that can recreate unreadable timestamp_ntz files under a concurrent schema change.

Comment on lines +662 to +673
if (snapshot_version.has_value())
{
auto latest_snapshot = std::make_shared<DeltaLake::TableSnapshot>(
/* version */ std::nullopt, kernel_helper, object_storage, log);
if (latest_snapshot->getVersion() == *snapshot_version)
table_timestamp_ntz_paths = snapshot->getTimestampNtzPaths();
}
else
table_timestamp_ntz_paths = snapshot->getTimestampNtzPaths();

auto delta_transaction = std::make_shared<DeltaLake::WriteTransaction>(
kernel_helper, snapshot->getTableSchema(), std::move(table_timestamp_ntz_paths));

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.

The new latest_snapshot->getVersion() == *snapshot_version check only proves the pin was current when we looked; it does not bind the transaction to that snapshot. On the partitioned path, WriteTransaction::create still reuses snapshot->getTableSchema() / table_timestamp_ntz_paths, while ffi::commit publishes against whatever schema is latest when the commit actually runs.

That means a schema-changing concurrent overwrite can still make us commit a file under a different schema. In the timestamp_ntz -> timestamp direction this branch is worse than master: we can publish isAdjustedToUTC=false and make Spark reject the new file again. The test added below also locks in the stale-pin case that deliberately writes an unreadable file. I think this path needs to fail closed for partitioned writes when delta_lake_snapshot_version is set, or use a transaction API that is actually bound to the caller's snapshot.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I checked both halves of this against the pushed tree. The exposure is real, and it is the limitation already stated in the known-limitation paragraph of #120863 (comment), but two of the premises and both proposed remedies do not survive measurement.

Commit time. The generated FFI documents commit as surfacing "conflicted and retryable CommitResult variants as errors today", so a concurrent commit landing after ffi::transaction ("Start a transaction on the latest snapshot of the table", called at WriteTransaction.cpp:175) fails the INSERT rather than re-basing it. The unguarded interval is the one between the snapshot read (DeltaLakeMetadataDeltaKernel.cpp:646-647) and that open, not "whatever schema is latest when the commit actually runs".

The pin does not create that interval. For an unpinned partitioned INSERT the snapshot is the one refreshed earlier in the same query (StorageObjectStorage.cpp:815-819 deliberately skips the refresh for a data lake because getExternalDynamicMetadata already did it), and both the write schema (WriteTransaction.cpp:200, unchanged from master) and the annotation (:201) are read from that same object. Failing closed only when delta_lake_snapshot_version is set would therefore reject an INSERT that succeeds on master today, while leaving the identical interval on the default path.

A transaction bound to the caller's snapshot is not reachable today. transaction_with_committer(snapshot, engine, committer) consumes a MutableCommitter, and the FFI's only producer is get_uc_committer, which needs a Unity Catalog commit client from get_uc_commit_client; a filesystem or S3 Delta table cannot build one. There is also no accessor for an uncommitted transaction's base version (only committed_transaction_version, post-commit), so the tighter check of the pin against the transaction's own version is not expressible either. Either route changes commit and conflict semantics for every Delta write, which is why I reported this residual for a maintainer ruling instead of guessing at it.

The test. The stale-pin leg asserts what master writes for that same INSERT, says so on the line above the assertion, and runs no Spark read afterwards. It pins the fail-open branch so that a later change cannot silently start annotating a stale pin, which is the direction that would make a timestamp_ntz to timestamp schema change produce a file master would have written correctly. Rejecting a pinned INSERT into a table with a timestamp_ntz column is a contract change I will make if the owners want it, but not one I will make unasked.

Triage: the race claim is a real residual, already disclosed, with both named remedies declined on the evidence above; the test claim is a framing point, not a defect. No code change from this round.

@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Sep 18, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - e9b0d77

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task whose
fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build profile diff infra: RuntimeError: CI logs cluster query failed, raised at ci/jobs/scripts/log_cluster.py:234; 243 distinct PRs carry the identical signature in 24h (252 error vs 115 success job rows) #118708 (mine, open)
Performance Comparison (arm_release, master_head, 5/6) measurement run reports 10 errors; this shard went from about 1 red/day to 163 reds on 2026-09-18, starting right after #120176 merged at 21:10Z, and it is red on master too #120923 (external, open)
Mergeable Check, PR praktika rollups of the two rows above, no independent failure #118708 (mine, open) and #120923 (external, open)
Sync - CH Inc sync (private, not actionable by me)

Neither red is reachable from this diff (DeltaLake timestamp_ntz Parquet annotation plus its test).
The Finish Workflow failure visible on this commit belongs to the superseded run 35363879590
(cancelled 15:44Z); on the live run 35364050635 it is green, and that run is 156 success / 15 skipped
/ 2 failures, both listed above.

Session id: cron:our-pr-ci-monitor:20260919-020058

@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

📊 Cloud Performance Report

✅ AI verdict: no_change — no significant changes across 31 queries analysed

no significant changes detected. K_source=6 K_base=30 flagged=0/65

clickbench

🟢 No significant changes

tpch_adapted_1_official

🟢 No significant changes

Debug info
  • StressHouse run: 8f7ccc2d-043e-4182-99ac-34ef6741b386
  • MIRAI run: 5be16f3b-f551-42d8-883c-00e4a01bc08c
  • PR check IDs:
    • clickbench_933193_1791756345
    • clickbench_933330_1791756372
    • clickbench_933444_1791756392
    • tpch_adapted_1_official_933542_1791756396
    • tpch_adapted_1_official_933649_1791756442
    • tpch_adapted_1_official_933747_1791756449

groeneai and others added 2 commits October 10, 2026 19:15
The writer reads the local-timestamp annotation only for DateTime and
DateTime64 columns, so a colliding leaf of any other type cannot be
affected by it. Only a Delta `timestamp` leaf (an instant) is a competing
claim on the path. Pruning for every colliding leaf left a `timestamp_ntz`
leaf UTC-adjusted, and so unreadable by Spark, when its dotted name
collided with, for example, an Int32 leaf.

Test: `si STRUCT<`a.b`: timestamp_ntz, a: STRUCT<b: Int32>>` in the
nested test; the previous head writes `si."a.b"` as `timestamp[us, tz=UTC]`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A partition column is never written to the data file, so it cannot
collide with a data leaf there. A `timestamp` partition column whose name
contains a dot (`p.ts`) shares its writer path with the leaf `ts` of a
struct `p`, and the collision check counted it, so a `timestamp_ntz` leaf
`p.ts` was written UTC-adjusted. Partition columns are now left out of
both path sets of the table schema, which also keeps a `timestamp_ntz`
partition column from annotating a written `timestamp` leaf at its path.

Test: a table partitioned by `p.ts`; the previous head writes `p.ts` as
`timestamp[us, tz=UTC]`. The test copies files with argv-only commands
because a timestamp partition directory name contains a space.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
auto-merge was automatically disabled October 10, 2026 19:47

Head branch was pushed to by a user without write access

@clickhouse-gh

clickhouse-gh Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing bf63649cb with master 630394453 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Object file sizes

18 object files changed (+57.16 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Storages/ObjectStorage/DataLakes/DeltaLakeMetadataDeltaKernel.cpp.o 568.13 KiB 593.75 KiB +25.62 KiB (+4.51%)

719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

148 translation units recompiled, 1392 s compile time in total, 148 of them have a recent master baseline.

Job report

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 12, 2026
Merged via the queue into ClickHouse:master with commit 371b23a Oct 12, 2026
163 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 12, 2026
alexey-milovidov added a commit to Onyx2406/ClickHouse that referenced this pull request Oct 13, 2026
…ath of the Parquet writer

`test_storage_delta/test.py::test_writes_timestamp_ntz_annotation_nested`, added on `master` in
ClickHouse#120863, writes a `Delta Lake` table whose struct has both a
field literally named `a.b` and a nested `a.b`. That is a legal Delta schema, and the Delta writer
handles the colliding path itself. This PR rejected every header with colliding dotted paths whenever a
datalake column mapping was present, so the `INSERT` failed with `BAD_ARGUMENTS`.

Keep the collision check for the user-facing `output_format_parquet_column_field_ids` /
`output_format_parquet_auto_assign_field_ids` settings only, and leave the datalake path as on `master`.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=101783&sha=3fc36efef301c451224b9470ea18204a0bc31c1b&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%201%2F4%29
PR: ClickHouse#101783

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 22, 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-request PR origin: a maintainer pinged or directed groeneai pr-bugfix Pull request with bugfix, not backported by default 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.

DeltaLake writes: INSERT into a timestamp_ntz column writes a UTC-adjusted Parquet timestamp, Spark cannot read the table

4 participants