Repository navigation
Conversation
Reading a Nested member subcolumn that a part does not store synthesizes a default column from the sibling's shared offsets. getBaseTypeOfArray walks the storage type consuming the tuple-element path, stops at the first type it cannot enter, and did not report how much of the path it had consumed. The caller stripped the whole path from the subcolumn name regardless, so createColumnWithDefaultValue received an empty subcolumn name, skipped IDataType::getSubcolumn, and built a default column carrying the parent's type. The block then disagreed with its own header, which a type-checking consumer rejects. With an element type of Array(Nullable(Tuple(a String, b Float64))), reading .b through merge() gives Unexpected return type from materialize. Expected Array(Nullable(Float64)). Got Array(Nullable(Tuple(String, Float64))). Nullable in that position is the third wrapper to stop the descent, after Tuple and Map, so instead of adding a fourth branch the descent now reports the length of the prefix it consumed and the caller leaves the remainder in the subcolumn name for IDataType::getSubcolumn to resolve. The array-level accounting subtracts the dimensions that extraction contributes, and a remainder that cannot be accounted for throws rather than building another malformed column. A complete descent leaves an empty remainder, so every shape that works today evaluates the original arithmetic unchanged. Both callers of fillMissingColumns were affected, so 04329 gains the Memory arms and 04770 the MergeTree and merge() arms. One 04329 arm puts the wrapper below a tuple element, so the descent consumes a strict prefix of the path rather than none of it or all of it, and a second does the same with a remainder that adds an array dimension of its own. The Compact reader finds a missing member's offsets in its own implementation, so it gets its own arm, which asserts the part kind and the absence of the member as well as the value. Every arm asserts through materialize, because a bare length passes on a wrongly typed column. A depth-numbered remainder such as .k.size1 is not made correct: it fails with Code 44 on master too, and only the subcolumn name in the message changes. Found by the targeted AST fuzzer on an unrelated pull request, STID 1611-37da, and reported by rorylshanks. It reproduces on plain master, by a plain ALTER TABLE ADD COLUMN, on Wide and Compact parts and on Memory, and by a direct read as well as through merge(). It needs enable_nullable_tuple_type, which is off by default, so it is not reachable in a default configuration. Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex) plus my own cold code review with
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20260826-160300 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260826-153500 |
|
cc @KochetovNicolai @CurtizJ, could you review this? |
|
Workflow [PR], commit [0be2fee] Summary: ❌
AI ReviewSummaryThis PR fixes default-column reconstruction for missing PR Metadata
Final Verdict✅ No blocking code issues found in the current diff. Change the changelog category to LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 25/31 (80.65%) · Uncovered code |
|
Changelog entry: agreed, rewritten. It was past tense and described internals; the new one follows Changelog category: keeping
Switching would also swap Body updated; no code change in this round. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units10772 translation units recompiled, 12728 s compile time in total, 10297 of them have a recent master baseline.
|
CI finish ledger - 0be2feeEvery failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Breadth places the cause off this branch: today that exact message produced 66 distinct PR carriers The fix is not an ancestor of this head ( 157 of the checks on this head are green and 20 are the usual skips; that one row and its two Session id: cron:our-pr-ci-monitor:20260826-230000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes an error when reading a subcolumn of a
Nestedmember added byALTER TABLE ... ADD COLUMNwhose element type wraps the tuple, for exampleArray(Nullable(Tuple(a String, b Float64))). Previously such a read failed withLOGICAL_ERRORon the rows written before the member was added; it now returns the default values.Description
Related: #110957 (comment)
Related: #113891
getBaseTypeOfArraywalks the storage type consuming a tuple-element path and stops at the first type it cannot enter. Its caller then stripped the whole path from the subcolumn name regardless of how much was consumed, socreateColumnWithDefaultValuegot an empty subcolumn name, skippedIDataType::getSubcolumn, and produced a default column of the parent's type.Nullablein that position is the third wrapper to land there afterTupleandMap, so instead of adding a fourth branch the descent now reports how many names it consumed and the caller leaves the remainder to the authoritative subcolumn extraction, subtracting the array levels that extraction contributes. No shape that master gets right changes: where the descent consumes the whole path the arithmetic reduces to the old one, and the new dimension term only removes levels the old code over-counted. An unaccountable remainder now throws instead of building another malformed column.Reachable by a plain
ALTER TABLE ... ADD COLUMN, onMergeTree(Wide and Compact) and onMemory, by a direct read as well as throughmerge(). Every shape I found has aNullable(Tuple)element, which is GA and allowed by default since 26.9: the official 26.9.1.1629 build returnsCode: 49here with default settings, and 26.6, 26.7 and 26.8 do withenable_nullable_tuple_type = 1. None returned wrong values rather than the error.Reported by @ rorylshanks from the targeted AST fuzzer, STID 1611-37da, check
AST fuzzer (amd_debug, targeted, old_compatibility): https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110957&sha=90a374d351eb9475c2ad4bde5c6f17cafce082a6&name_0=PR&name_1=AST%20fuzzer%20(amd_debug%2C%20targeted%2C%20old_compatibility). It is not caused by that pull request: I reproduced it on plain master. Issue 113891 is a different site (a mutation write, nofillMissingColumnsframe) and is not fixed here. The same shape later hitAST fuzzer (amd_tsan)on #117830: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=117830&sha=7491d4607a38d8a06a2bb0f0bed5097013f78c0f&name_0=PR&name_1=AST%20fuzzer%20%28amd_tsan%29Validated shapes, base vs fixed (click to expand)
MergeTreeWide, member re-added, read viamerge().b99.b[] [NULL] [NULL,NULL]ADD COLUMN, noDROP, no mutation.b.bENGINE = Memory.bb[NULL,NULL,NULL]Mapinside the tuple.k.keys[] [[]] [[],[]]Arrayinside the tuple.k[] [[]] [[],[]].k.bb[NULL,NULL,NULL].k.m.keys[[],[],[]]share_nested_offsets = 0.b.bArray(Point), no settings.1Array(Variant(...)),Array(Dynamic).UInt64Not made correct, and unchanged from master: a depth-numbered remainder such as
.k.size1fails withCode: 44on both, only the subcolumn name in the message differs.Both existing test files gained arms rather than a new file:
04329owns theMemoryreader,04770theMergeTreeWide and Compact readers and the reportedmerge()read. Every arm asserts throughmaterialize, because a barelengthpasses on a wrongly typed column; the one exception is themerge()arm, which asserts through that path's own converting step, the shape that was reported. 50 randomized runs of each file pass, as do 13 neighbouringNestedsubcolumn tests.Workflow [PR]
Sync PR [sync-upstream/pr/116553]