Repository navigation
Pin the dotted Nested .null subcolumn read after a metadata-only Nullable ALTER - #113646
PedroTadim merged 2 commits into
Conversation
…data-only Nullable ALTER A part written before a metadata-only `T` -> `Nullable(T)` `MODIFY COLUMN` still holds non-nullable data and has no `.null` substream, so the null map has to be derived from the parent column that is present in the part. For a dotted `Nested` member that requires resolving the parent from metadata: `Nested::convertToSubcolumns`, reached whenever `share_nested_offsets` is on (default true), rebuilds the requested `arr.n.null` as a subcolumn `n.null` of `arr`, so `getNameInStorage()` returns `arr` while the part supplies `arr.n`. `NamesAndTypesList::contains` is an exact-name compare, so comparing the remapped spelling directly does not find the parent and the column falls through to `createColumnWithDefaultValue`, giving an all-NULL null map where all-zero is correct. Master resolves the parent from metadata and is correct. Nothing pinned that, which is what this test adds. Restoring the older inline spelling and running every plausible pinner shows all of them pass: `03210`, `04161`, `04338` and `04697` (the stateless tests holding both a `MODIFY COLUMN ... Nullable` and a dotted or declared-`Nested` column), plus `03742` and `04770`. The uniform reason is that a read of `.null` on a dotted column occurs zero times in all six, and that read is exactly what the remap rewrites. The test keeps the part unrewritten (`SYSTEM STOP MERGES` before an `alter_sync = 0` ALTER, asserted via `system.parts_columns`), since a synchronous ALTER materialises the substream and would turn every row into a control. Two witnesses cover a Wide and a Compact part, which are different readers: Nested is collected into `part_columns` only for wide parts, while `fillMissingColumns` receives the remapped list unconditionally. Two controls must read the same either way: `share_nested_offsets = 0`, where no remap happens, and an undotted column. With the inline spelling restored, both witnesses move from `[0,0]` to `[1,1]` while all four control lines stay unchanged. 100 runs pass on master, 50 randomized and 50 with randomization off. The test is untagged: `share_nested_offsets` is not randomized, and the randomized MergeTree settings it depends on are pinned in `CREATE TABLE ... SETTINGS`, which wins over runner injection.
Internal second-model review (click to expand)An independent cold review plus a second-model gate ran over this change before it was opened.
💡 Asymmetry noted, deliberately not changed. The Wide arm proves the part is still the Verified independently while reviewing, rather than taken from the author's notes: the remap is The second-model gate returned no findings, having read the complete new SQL and reference, the Session id: cron:clickhouse-review-slot-11:20260806-100300 |
Pre-PR validation gate (click to expand)
|
|
cc @CurtizJ, could you review this? It is test-only: nothing in the suite pinned reading the |
|
Workflow [PR], commit [c0d61c6] Summary: ❌
AI ReviewSummaryThis PR adds a stateless regression test for reading the Final Verdict✅ No blocking issues found. |
CI finish ledger — c0d61c6Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
Not caused by this PR: the diff is two stateless test files The hung row read from the The remaining 174 check-runs are 57 success and 116 skipped, with Session id: cron:our-pr-ci-monitor:20260806-143000 |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add a regression test for reading the
.nullsubcolumn of a dottedNestedmember on a part written before a metadata-onlyTtoNullable(T)ALTER.Description
Test-only, no
src/change.A part written before a metadata-only
T->Nullable(T)MODIFY COLUMNhas no.nullsubstream, so the null map must be derived from the parent column that is in the part. For a
dotted
Nestedmember the parent has to be resolved from metadata:Nested::convertToSubcolumns(on by default viashare_nested_offsets) rebuilds the requestedarr.n.nullas a subcolumnn.nullofarr, so itsgetNameInStorage()becomesarrwhilethe part supplies
arr.n. Comparing that remapped spelling directly does not find the parent, andthe column is default-filled to all-NULL: wrong results at default settings.
Master resolves the parent from metadata and is correct; the gap is that no test pinned it.
Restoring the inline spelling and running every plausible pinner, all pass: the four stateless
tests holding both a
MODIFY COLUMN ... Nullableand a dotted or declared-Nestedcolumn(
03210,04161,04338,04697), plus03742and04770. So a "this predicate looks dead,remove it" change reintroduces the wrong results with every check green.
The test asserts the
.nullvalue (not just its length, which is what makes an existingneighbour blind here) on an unrewritten Wide and Compact part, plus two controls that must read the
same either way:
share_nested_offsets = 0and an undotted column. It also asserts the part isstill the pre-ALTER one, since a synchronous ALTER would rewrite it.
On that same binary both witness rows go
[0,0]->[1,1]while all five control lines areunchanged, which is what makes the failure attributable. 100/100 runs pass on master (50
randomized, 50 off). Untagged:
share_nested_offsetsis not randomized, and the randomizedsettings the test needs are pinned in its
CREATE TABLE ... SETTINGS.The release branches still carry the inline spelling, so this class may be live there. This test is
master-only.
Version info
26.8.1.931(included in26.8and later)