Repository navigation
Read Iceberg time columns of Parquet data files as microseconds - #126079
alexey-milovidov merged 3 commits into
Conversation
ClickHouse maps the Iceberg `time` type to `Int64` holding microseconds since midnight, and every carrier of the value uses that number: manifest min/max bounds, manifest-list partition summaries, identity partition values, the `bucket` transform and ORC/Avro data files. Only the Parquet decoder disagreed: it read the TIME(MICROS) column as `Time64(6)` and cast it to the requested `Int64`, i.e. to whole seconds. So `WHERE t = <shown value>` was pruned against bounds in another unit and returned no rows, and an identity-partitioned table showed microseconds while an unpartitioned one showed seconds. The Iceberg `ColumnMapper` now carries the field ids whose type is `time`, and the Parquet `SchemaConverter` decodes such a column requested as `Int64` with the plain INT64 decoder (its statistics and hash filters then describe the stored value). Plain Parquet reads are unchanged. The Iceberg reads that did not pass a mapper get one: equality-delete files keyed on a `time` column (the key columns are read as `Int64` too), the compaction read, and Parquet data files of a table configured with another format. Closes ClickHouse#118807. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oup pruning A Parquet file without field ids resolved a `time` column by its traversal name, which for a list element is the list's own name and for a map key is the map's name, so those kept the seconds cast. Iceberg stores no type other than `time` as Parquet TIME, so in a table that has `time` fields a TIME(MICROS) column of such a file requested as `Int64` is a `time` field at any depth: decide by `hasIcebergTimeFieldIds()` instead of a name lookup. The integration test covers a field-id-less file with a struct field, a list element and a map key, and a file of three row groups without column bounds, asserting that `ParquetPrunedRowGroups` is 2 (the new decoder keeps the INT64 statistics). The equality-delete key is retyped to the field's mapped type rather than a hard-coded `Int64`, and compaction reads with the same mapper it writes with (only the reader consults the last assigned field id). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Drop the processPrimitiveColumn parameter note and the compaction field-id note; keep the field-id-less fallback rationale on one line. 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) in two rounds, plus my own review. Round 2 (
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261015-170300 |
|
Workflow [PR], commit [35cfb80] Summary: ✅
AI ReviewSummaryPR #126079, reviewed at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No inline findings to post; CI validation remains pending. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261015-163900 |
|
cc @al13n321 @SmitaRKulkarni, could you review this and add |
3cadbba
Closes: #118807
Closes: #88063
Related: #105540
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Iceberg
timecolumns read from Parquet data files are now returned as microseconds since midnight, as documented, instead of whole seconds. The value now agrees with the manifest statistics and partition values, soWHEREon such a column no longer misses rows and the unit no longer depends on the partition spec. Closes #118807. Closes #88063.Description
On 26.8.18.2, for an Iceberg table written by pyiceberg with a
timecolumnt(the script in #118807),SELECT tshows5400for01:30:00.25, butWHERE t = 5400returns no rows with default settings (also on 26.3.42.3), and the same data in a table partitioned byidentity(t)shows5400250000.Root cause: ClickHouse maps Iceberg
timetoInt64microseconds (the documented mapping), and the manifest bounds, partition values,buckettransform and ORC/Avro data files all carry that number. Only the Parquet reader decoded theTIME(MICROS)column asTime64(6)and then cast it toInt64, i.e. to seconds. So min/max pruning compared a seconds literal with microsecond bounds, and an identity partition substituted microseconds for the seconds of the file.Change: the Iceberg column mapper carries the field ids of
timecolumns, and the Parquet reader decodes such a column requested asInt64as the plain stored integer, statistics and bloom filters included. Plain Parquet reads are unchanged. The Iceberg reads that had no mapper get one: equality-delete files keyed on atimecolumn,OPTIMIZEcompaction, and Parquet data files of a table configured as ORC/Avro. The type staysInt64, so this does not overlap #105540 (Time64(6)).Backward incompatible: a Parquet-backed
timecolumn that showed seconds now shows microseconds, as an identity-partitioned table already did.Validation: the new integration test (unpartitioned, identity, bucket, a file without field ids (also nested), nested struct and list, a table configured as ORC, equality deletes, compaction, Parquet row-group pruning) fails on master and passes with the fix; reverting each of the three mapper wirings separately fails exactly its part.
Workflow [PR]
Sync PR [sync-upstream/pr/126079]
Version info
26.11.1.30-master(included in26.11and later)