Repository navigation
Conversation
An Iceberg `timestamp` / `timestamp_ns` stores a wall-clock reading (Spark `TIMESTAMP_NTZ`). It was mapped to a zone-less `DateTime64(6)` / `DateTime64(9)`, so the value was rendered, and string literals were parsed, in the session time zone: under `Asia/Shanghai` a stored `2024-06-11 12:34:56.123456` showed as `20:34:56.123456`, `WHERE ts = '2024-06-11 12:34:56.123456'` returned 0 rows, and an INSERT under a non-UTC session stored the literal shifted by the session offset. Map both types to an explicit `'UTC'` zone, where the stored ticks and their rendering coincide, as Paimon does for `TIMESTAMP WITHOUT TIME ZONE` and as the Parquet reader does for `isAdjustedToUTC = false`. `timestamptz` keeps its mapping. The Avro type of a manifest partition field took `adjust-to-utc` from whether the ClickHouse type has an explicit time zone; with the new mapping every identity `timestamp` partition would be declared `timestamptz` in the manifests ClickHouse writes. Take the flag from the Iceberg type of the partition's source field instead (field ids are table-global, so the union over all schemas resolves it for any schema a manifest is written for). Rewrite 05213 (its literals were instants in the session zone, which no longer name the stored rows), update the type expectations of 04029, 05477, the gtest and the catalog integration tests, and add 05569. Closes ClickHouse#130025 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; 4 findings) plus my own cold review (3 nits).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261108-080200 |
|
cc @scanhex12 @alesapin, could you review this and add the |
|
Workflow [PR], commit [3d53742] Summary: ✅
AI ReviewSummaryThe PR maps Iceberg Consumer tracing covered Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes19 object files changed (-20.37 KiB total), 0 added.
716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units128 translation units recompiled, 1009 s compile time in total, 128 of them have a recent master baseline. Median compile-time ratio to the baselines is ×1.05 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
…ormance tests The Iceberg configuration rewrites the test's `DateTime` and `DateTime64` Memory tables as Iceberg tables, whose `timestamp` columns are now read back as `DateTime64(6, 'UTC')`. `toUTCTimestamp` and `fromUTCTimestamp` reject an argument with an explicit time zone, so every query of the test failed on the new server (`Performance Comparison (arm_release, master_head, iceberg_local|iceberg_s3, 2/3)`). The MergeTree configuration still runs the test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Am I right than this PR makes type |
|
Yes, for the ClickHouse type: with this PR both are read as They stay distinct on the Iceberg side. An existing table keeps its declared Iceberg types, and in manifests ClickHouse writes, the On your PRs: with #94025, |
…mestamp-without-time-zone-utc
Conflicts:
- SchemaProcessor.{cpp,h}: master added collectIcebergPrimitiveTypesById, so the manifest
`adjust-to-utc` lookup in IcebergWrites.cpp uses it and the PR's own
collectIcebergTimestamptzFieldIds is dropped; master also removed updateLastColumnId.
- getSimpleType: timestamptz now takes master's `timezone_for_timestamptz`, timestamp and
timestamp_ns keep `DateTime64(6|9, 'UTC')`.
- Utils.{cpp,h}: master's new variant helpers next to the `adjust_to_utc` parameter of getAvroType.
- registerStorageObjectStorage.cpp: type table rows combine both changes.
- test_database_glue: master removed test_timestamp_types_cache_does_not_keep_metadata with the
Glue schema cache.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e by the Iceberg type The database rewrote every `DateTime64` with an explicit 'UTC' zone in the catalog schema to the configured zone. With Iceberg `timestamp` now read as `DateTime64(6, 'UTC')` too, that also moved `timestamp` columns: under `iceberg_timezone_for_timestamptz = 'Europe/Berlin'` a REST catalog table declared `timestamp Nullable(DateTime64(6, 'Europe/Berlin'))` in SHOW CREATE TABLE, while SELECT, which reads the type from the Iceberg metadata, returned 'UTC'. Pass the zone to the catalog with the table metadata request instead, so the REST, Hive and Glue catalogs give it to `IcebergSchemaProcessor` when they convert the Iceberg types, as the table engine already does through the same table setting. Update 05616 and 05620 for the `timestamp` mapping (only the type lines change; in 05620 the `timestamp` column now stays `DateTime64(6, 'UTC')` under the Berlin setting), and check the `timestamp` column of the Berlin database in test_database_iceberg. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s written for The flag of a timestamp partition field was looked up in a union of all historical schemas that kept the first type seen for each field id. Iceberg v3 lets an `unknown` field be promoted to any type, so a field that was `unknown` in schema 0 and is `timestamptz` now got `adjust-to-utc: false` in the manifests of a ClickHouse INSERT (master writes `true`). Read the source type from the schema the manifest declares instead: `schema_to_serialize` when given, else the current schema. 05569 covers the promoted field. 05743 compares an Iceberg `timestamp` column, now read in UTC, with a `timestamp()` bound built in the session time zone, so a randomized non-UTC session changed the pruned-file count (CI: 2 instead of 3 under America/Mazatlan). Pin its session time zone to UTC. Update the comments of 05212 and 05315 that still described `timestamp` as read in the session time zone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #130025
Related: #130016
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg
timestampandtimestamp_nscolumns (without time zone) are now read asDateTime64(6, 'UTC')andDateTime64(9, 'UTC'), so their values are shown as stored and compared with string literals the same way in anysession_timezone, and anINSERTunder a non-UTC session stores the value as written.toUTCTimestamp/fromUTCTimestampnow reject them (usereinterpret(ts, 'DateTime64(6)')). Closes #130025.Description
On 26.10.2.103-stable, with
session_timezone = 'Asia/Shanghai',SELECT ts FROM icebergLocal(...)over a SparkTIMESTAMP_NTZcolumn holding2024-06-11 12:34:56.123456returns2024-06-11 20:34:56.123456, andWHERE ts = '2024-06-11 12:34:56.123456'returns 0 rows.An Iceberg
timestampstores a wall-clock reading, but it was mapped to a zone-lessDateTime64(6)(timestamp_nstoDateTime64(9)), so values were rendered and literals parsed in the session time zone.IcebergSchemaProcessor::getSimpleTypenow adds'UTC', where the stored ticks and their rendering coincide, as Paimon mapsTIMESTAMP WITHOUT TIME ZONE.DESCRIBEshows the new type; under a UTC session values and filters are unchanged. Rows ClickHouse inserted from literals under a non-UTC session were stored shifted and now read back as Spark reads them. Perf testutc_timestamp_transformskips Iceberg:toUTCTimestamprejects the new type.timestamptzkeeps followingiceberg_timezone_for_timestamptz(#130772). A DataLakeCatalog database applied it to every'UTC'DateTime64of the catalog schema, which would now movetimestamptoo; the catalogs now apply it when converting the Iceberg types.Written manifests took a timestamp partition field's
adjust-to-utcfrom the ClickHouse type's zone; it now follows the Iceberg type of the source field.Validation: new test
05569(Spark- and ClickHouse-written identity-partitioned tables underAsia/Shanghai, pruning on/off, the manifest flag, also of a field promoted fromunknown);05213uses the stored values as literals; types updated in04029,05477,05616,05620, the gtest and the Glue/REST/Nessie integration tests, REST also checking a Berlin database. All fail on master and pass here.05743pins UTC for itstimestamp()bound.Open #114859 and #118601 touch adjacent code.
Workflow [PR]
Sync PR [sync-upstream/pr/130123]