Repository navigation
Fix reading a subcolumn of a struct inside an array from Iceberg tables with Parquet data files - #132229
Fix reading a subcolumn of a struct inside an array from Iceberg tables with Parquet data files#132229groeneai wants to merge 4 commits into
Conversation
…uet files Since ClickHouse#102362 `processSubtreeArrayInner` replaced the name of a list element with its ColumnMapper name (`l.element`). `TraversalNode::name` has two roles: the parent path that `useColumnMapperIfNeeded` strips from the mapped names of the children (needs `l.element`), and the name looked up among the requested columns, where array levels are transparent (`l.x`). The override fixed the first role and broke the second, so `l.x` or `profile.hobbies.name` was never matched and was filled as a missing column: empty arrays for every row of an Iceberg table with Parquet data files carrying field ids. Keep `name` reader-side and carry the mapper path in a separate `column_mapper_path` (unset means equal to `name`), extended by `appendNameComponent` together with `name`. All `useColumnMapperIfNeeded` call sites use it, and `TupleInArray` records it, so `addMissingElementOfTupleInArray` resolves the children of the tuple by mapper path while it matches the requested name by reader name: a member added to a list after the file was written, read alone, gets the list sizes. At every node the mapper path equals the old `name`, so every mapper-derived result is unchanged. Same approach as ClickHouse#128775. The `initial-default` lookup of such a member from ClickHouse#130101 is not here: it needs code that exists only in ClickHouse#130101. Closes ClickHouse#130023 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review (2 rounds; final round: 0 findings)
|
|
cc @grantholly-clickhouse, could you review this? The Parquet SchemaConverter used the Iceberg column mapper name of a list element (l.element) as the requested-column name, so a subcolumn under a list such as profile.hobbies.name was never matched and read as empty arrays; the element now keeps its reader name and the mapper path is carried separately. |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-7:20261117-030500 |
|
Workflow [PR], commit [ab46c11] Summary: ✅
AI ReviewSummaryPR #132229 separates requested subcolumn names from Iceberg field paths when reading Parquet arrays. It preserves array offsets and applies Missing context / blind spots
Final VerdictStatus: ✅ Approve |
CI finish ledger - 6ae1369Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261117-080018 |
…rquet-list-element-subcolumn The `initial-default` code of ClickHouse#130101 (merged 2026-11-18) relies on the list element node being named with the column mapper path, which this PR changes: 05568_iceberg_initial_default fails on the merge of this PR with master. The fix in the next commit uses that code, so it needs master.
…column mapper path ClickHouse#130101 keyed the field ids of a struct, and looked up the default of a missing tuple element, by `TraversalNode::name`, which master set to the column mapper path (`l.element`) inside a list. This PR keeps `name` the ClickHouse name (`l`), so on the merge with master a field added with an `initial-default` to the element struct of a list was read as NULL, or threw THERE_IS_NO_COLUMN with `input_format_parquet_allow_missing_columns = 0` (05568_iceberg_initial_default). Both lookups now use `getColumnMapperPath()`. The subcolumn `l.y` of such a field, read without the rest of `l` (addMissingElementOfTupleInArray), now takes the `initial-default` of `l.element.y` instead of NULL, keeping the sizes of `l`, also with `input_format_parquet_allow_missing_columns = 0`, which now only rejects it when there is no default. Requested on ClickHouse#130023 (issuecomment-6935263914). ORC already read these values. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…om the field that has it The subcolumn `l.a.v` of a list of structs `a` added to the elements of `l` was looked up as the field `l.element.a.v`, which has no default (the default belongs to `l.element.a`), so it read as empty arrays. `ColumnMapper::getIcebergFieldPath` now takes the struct its walk ends at, and the Parquet reader resolves the field under the element struct of the list with it, the same way as for a top-level column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units157 translation units recompiled, 1200 s compile time in total, 157 of them have a recent master baseline. |
Closes: #130023
Related: #128775
Related: #130173
Related: #130101
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed reading a subcolumn of a struct inside an array (for example
profile.hobbies.nameorfriends.nickname) from Iceberg tables with Parquet data files, which returned empty arrays. Closes #130023.Description
On 26.10.4.207,
SELECT profile.hobbies.name FROM icebergLocal(...)over the Parquet copy of the issue's Doris table returns[]instead of['Reading','Swimming','Cooking']; the ORC copy andarrayMap(x -> x.name, profile.hobbies)are correct.Since #102362,
SchemaConverter::processSubtreeArrayInnerreplaced the name of a list element with its column mapper name (l.element). That name is also the one looked up among the requested columns, where array levels are transparent (l.x), so a requested subcolumn under a list was never found and was filled as a missing column. The element now keeps its name, and the mapper path is carried separately inTraversalNode::column_mapper_path(and inTupleInArray), which is what theuseColumnMapperIfNeededcall sites use. A member added to a list after the file was written, read alone, now also keeps the list sizes.Same approach as #128775 by @ josephperez3. My #130173 has the same split as part of the name mapping work; whichever of the two merges second drops it. The
initial-defaultlookups of #130101 under a list now use the mapper path too, and a member added with one, read alone asl.y(or a subcolumn of it), resolves to the fieldl.element.yto take it instead of NULL.Validation: the new test
05814(list in a struct, nested lists, struct in a struct in a list, a member inWHEREand one read after aPREWHERE), two queries added to03548and six to05568fail on master and pass with the fix; ORC and Parquet copies of the Doris tables from #130016 return the same rows; 538 of the 616 Iceberg and Parquet stateless tests pass with the fix, the others need S3 or fail on master too.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/132229]