Repository navigation
Conversation
…hema For Parquet, `filterTupleColumnsToRead` turns a requested tuple element such as `s.a` into a flat column with name-in-storage `s.a`, which the native reader produces directly. For a data file whose schema id differs from the current one (after ADD/DROP/RENAME/MODIFY COLUMN by any writer) `createReader` replaces the reader header with the file's full schema, so the reader and the Iceberg schema transform produce whole top-level columns (`s`) and the final `ExtractColumnsTransform` failed with NOT_FOUND_COLUMN_IN_BLOCK. On that branch, extract every requested name-in-storage that the block lacks but that is a subcolumn of a column the block has, using `createSubcolumnsExtractionActions`. The block carries the current schema's names at that point, so elements resolve by the current name (also after RENAME COLUMN). Files read with their own header are untouched, and a name that resolves to nothing still fails as before. Closes ClickHouse#125252 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review: an own cold review plus an independent model (engine: codex; 0 findings). Own review: 2 nits, both refuted by code reading.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20261012-140800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261012-131700 |
|
Workflow [PR], commit [819ea5a] Summary: ❌
AI ReviewSummaryRestores tuple-element reads from older-schema Iceberg files by extracting requested elements after schema transformation and before fallback filters. Includes filter-only inputs, preserves Paimon extraction, and adds focused stateless regression coverage. No unresolved findings remain at commit 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 Compile time of recompiled translation units7 translation units recompiled, 22 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - 587ab9cEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261012-220018 |
|
@scanhex12 I leave it to you |
…olumn reads The corpus test added in ClickHouse#128305 recorded `NOT_FOUND_COLUMN_IN_BLOCK` for `st.x` and `st.y` of the two schema-evolution tables, which is the bug this PR fixes (ClickHouse#128304). With the fix they read correctly. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125439&sha=9fe14419561a364025085b57a894cced615832e7&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
…ple-element-schema-change
…ema-changed path The extraction of tuple elements that `filterTupleColumnsToRead` made flat columns ran after the fallback `FilterTransform`s, so an explicit `PREWHERE` (or a row policy) on an element of a data file written under an older schema still failed with `NOT_FOUND_COLUMN_IN_BLOCK`: the stripped filter is replayed after the schema transform and takes the flat name as input, and `requested_columns` is post-`PREWHERE` and does not list a column consumed by a filter only. Move the extraction to right after the schema transform and extract the inputs of the stripped filter DAGs as well. The test now covers an element used by an explicit `PREWHERE` only, by `PREWHERE` together with the select list, by a row policy, and by `PREWHERE` after `RENAME COLUMN`. Review threads: ClickHouse#125439 (comment) and ClickHouse#125439 (comment)
…eld-id reads A file read under its own names yields whole columns, while `filterTupleColumnsToRead` asks for a tuple element (`s.y`) as a flat column, so `SELECT s.y` on a file written before a top-level rename threw NOT_FOUND_COLUMN_IN_BLOCK. Extract the requested elements after the schema transform, as ClickHouse#125439 does for Iceberg (gated to Paimon objects here). Fields inside a ROW are still matched by name: after a nested rename, or a nested drop and re-add under the same name, an older file returned NULL for the renamed field or the dropped field's values. The schema mapping now compares nested field ids and names (through ARRAY, MULTISET and MAP) and refuses such a file with NOT_IMPLEMENTED and the recovery text of ClickHouse#127816. The docs say that only top-level columns are matched by field id. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A tuple element in PREWHERE is rejected at analysis for object storage (`Code: 182 ... does not support column s.a in PREWHERE`, ILLEGAL_PREWHERE): `StorageObjectStorage` does not override `supportedPrewhereColumnsIncludeSubcolumns`, so `CollectTableExpressionData` refuses `s.a`, `s.b`, `s.c.x` and `r.a`. The arms that put an element in PREWHERE therefore failed in every stateless job. The stripped PREWHERE that is replayed after the schema transform of the old-schema data file stays covered with a PREWHERE on `id`: with `s.a` selected, under the row policy on `s.a`, and with `r.a` selected after RENAME COLUMN. The Nullable element is filtered in WHERE instead, and the duplicate of the earlier `WHERE s.a = 20` arm is dropped. Each changed arm fails with NOT_FOUND_COLUMN_IN_BLOCK on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵️ @groeneai The fix looks right to me. On the schema-changed path the reader gets the file's full schema, so a tuple element that Since the last merge of master, Paimon field-id reads take this path too:
Nit: many tests already use the |
A Paimon file read under its own names has an initial schema, so it takes the schema-changed path, whose extraction after the schema transform already produces every requested element. The one at the end of `createReader` (f16a898) found them present and did nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Paimon table renames its `ROW` column after the first commit, so the first file is read under its own names; `r.a` is selected and used by a row policy. `05366` is taken by many tests, so the test is now `05616` (the next free number, as `add-test` assigns it). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks, all three are done:
50/50 randomized runs pass; master still fails the Iceberg queries with Code 10. |
Drop the checked-in data_minio/paimon_row_rename fixture: the test now writes the two schema files, the snapshot, the manifest list, the manifest and the two Parquet data files itself (the first one under schema 0, with the ROW column still named s), like 05301_paimon_manifest_path_traversal does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes: #125252
Closes: #128304
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
NOT_FOUND_COLUMN_IN_BLOCKwhen reading a tuple element (e.g.s.a) of an Iceberg table from data files written before a schema change such asALTER TABLE ... ADD COLUMN.Description
On 26.8.18.2 (and 26.9.16.11, as reported in #125252), after
ALTER TABLE t ADD COLUMN extra Nullable(Int64)on an Iceberg table,SELECT id, s.a FROM tfails withNot found column or subcolumn s.a in block (NOT_FOUND_COLUMN_IN_BLOCK)for data files written before the change, whileSELECT id, sworks.For Parquet,
filterTupleColumnsToReadturnss.ainto a flat column that the reader produces directly. For a file written under an older schema id,StorageObjectStorageSource::createReaderreplaces the reader header with the file's full schema, so the reader and the Iceberg schema transform return the wholesand the finalExtractColumnsTransformcannot finds.a.On that path, requested columns that the block lacks but that are subcolumns of a column it has are now extracted with
createSubcolumnsExtractionActions. The block carries the current schema's names at that point, so an element resolves by its current name, also afterRENAME COLUMN. Files read with their own header are unchanged, and a name that resolves to nothing still fails as before. Paimon field-id reads of files written before a top-level rename take this path too, so the extraction master runs for them at the end ofcreateReaderhad nothing left to do and is removed.The new test reads a Nullable element, a nested element, an
Array(Tuple)element, aWHEREon an element, a row policy on an element, aPREWHEREon a top-level column with an element selected, theicebergLocaltable function and an element afterRENAME COLUMN, each from an old-schema file next to a current-schema one, and an element of a renamed PaimonROWcolumn, selected and in a row policy. It fails on master and passes with this change (50 randomized runs, also with parallel replicas).DROP COLUMNandMODIFY COLUMN(type promotion) failed the same way and are fixed as well.Workflow [PR]
Sync PR [sync-upstream/pr/125439]