Repository navigation
Resolve the 26.3 cherry-pick of #110584: Fix IS NULL after metadata-only T to Nullable(T) ALTER with optimize_functions_to_subcolumns - #116837
Conversation
Port the merged master fix "Fix IS NULL after metadata-only T to Nullable(T) ALTER with optimize_functions_to_subcolumns" (ClickHouse#110584) onto 26.3, which is the only supported branch still missing it. On 26.3, a part written before a metadata-only ALTER TABLE t MODIFY COLUMN x T -> Nullable(T) has no .null substream. With optimize_functions_to_subcolumns = 1 (on by default) IS NULL, IS NOT NULL and count(x) are rewritten to read x.null, and that subcolumn is default-filled from the storage type instead of being derived from the present parent column, so rows that hold real data are reported as NULL. Measured on official 26.3.25.1: SELECT count() FROM t WHERE id = 1 AND x IS NULL returns 1 where the answer is 0, and SELECT x, x.null returns "42 1" instead of "42 0". The robot cherry-pick ClickHouse#112447 could not be applied and was closed by a timer rather than by a decision. All three conflicts have one cause: fillMissingColumns gained a master-only bool share_nested_offsets parameter after the 26.3 cut, and this fix appends a further parameter after it, so both sides edit the same parameter list. share_nested has zero occurrences in src/ on 26.3, so that parameter is dropped and additional_available_columns is kept. Nothing else is adapted: the guard body, the evaluateMissingDefaults rewrite, both MergeTree call sites and all four test files land byte-identical to master. MergeTreeLazilyReader does not exist on 26.3, and MergeTreeReadersChain runs fillMissingColumns before performRequiredConversions exactly as master does, so the fix is exercised in the order it was designed against. Related: ClickHouse#110584 Related: ClickHouse#112447 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; 3 findings; reviewed
Severity: ❌ blocker / Why fidelity is the standard applied to all three: the resolution's whole claim is that it is Session id: cron:clickhouse-review-slot-10:20260828-071300 |
|
Workflow [BackportPR], commit [ea5e291] Summary: ❌
|
Pre-PR validation gate (click to expand)
Known limitation, unchanged by this port and identical on master and every other branch that carries #110584: when the parent was renamed by Validation on 26.3: Session id: cron:clickhouse-impl-slot-6:20260828-054600 |
|
cc @CurtizJ @CheSema, could you review this? It is the 26.3 leg of #110584, which the robot cherry-pick could not apply: all three conflicts are the same parameter list, because |
CI finish ledger -
|
| Check / test | Reason | Owner / fixing PR |
|---|---|---|
Stateless tests (amd_asan, db disk, distributed plan, sequential) / 02916_another_move_partition_inactive_replica |
the 26.3 copy of this test asserts the exact part NAMES left after two OPTIMIZE statements (all_0_1_1, all_2_3_1), and which adjacent pairs a racing merge assignment picks is not deterministic on this shape. This run produced all_0_0_0 and all_1_3_2, i.e. the same TWO active parts under different names |
fixing PR #100924 (external, merged 2026-03-31), absent from 26.3 |
The owner is exact rather than same-area: #100924 "Fix flaky test
02916_another_move_partition_inactive_replica" replaces that assertion with
select count() from system.parts ... and active against a reference of 2, so this run's output
satisfies the fixed test and fails only the pre-fix one. The 26.3 blob still carries the old
select name, active form, so the fix is not on this branch. It is a test-only change on master;
bringing it to 26.3 is a v26.3-must-backport label on #100924, which is a maintainer action, so I
am not hand-authoring it here and it is deliberately not folded into this cherry-pick.
Independently of that, the tree is exonerated by a control this head supplies for free: the two
concurrent runs executed the same commit and the same leg, and disagreed. A verdict that flips
between two runs of one tree is state or timing dependent, not tree dependent. This PR's diff is the
read-path column materialization for a metadata-only Nullable ALTER plus its two tests, and it
touches nothing that selects parts for merging.
Session id: cron:our-pr-ci-monitor:20260828-100000
|
backporting the PR that fixes the CI failure |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix wrong
IS NULL/IS NOT NULL/count()results withoptimize_functions_to_subcolumnson a column that was madeNullableby a metadata-onlyALTER MODIFY COLUMN TtoNullable(T). For parts written before the conversion, the.nullsubcolumn was filled from the storage-type default (NULL) instead of being derived from the physically-present parent column, so existing not-null rows were wrongly reported as NULL.Description
Related: #110584 (the merged master fix), #112447 (the robot cherry-pick), #110555 (the reported bug).
26.3 is the only supported branch still missing #110584. That fix reached 26.5, 26.6 and 26.7 as #112448, #112449 and #112450, all merged by the robot, and #110584 carries
pr-must-backportpluspr-backports-created. The 26.3 leg was closed byrobot-ch-test-pollon a 7-day inactivity timer, not by a decision, so this PR only resolves the conflicts the automation could not apply.What breaks on 26.3: a part written before a metadata-only
ALTER TABLE t MODIFY COLUMN x TtoNullable(T)has no.nullsubstream. Withoptimize_functions_to_subcolumns = 1, which is on by default,IS NULLis rewritten to readx.null, and that subcolumn is default-filled from the storage type instead of being derived from the physically-present parent column, so rows that hold real data are reported as NULL. Measured on official26.3.25.1:SELECT count() FROM t WHERE id = 1 AND x IS NULLreturns 1 where the answer is 0, andSELECT x, x.nullreturns42 1instead of42 0. Official26.6.4.30matches the expected output byte for byte.All three conflicts have one cause:
fillMissingColumnsgained a master-onlybool share_nested_offsetsparameter after the 26.3 cut, and this fix appends a further parameter after it, so both sides edit the same parameter list.share_nestedhas zero occurrences insrc/on 26.3, so that parameter is dropped andadditional_available_columnsis kept. Nothing else is adapted: the other eight files, all four test files included, land byte-identical to master.Validation on 26.3: the ported test reproduces the wrong values without the change and matches its reference with it, and
04161_null_subcolumn_after_metadata_only_nullable_alterplus02941_variant_type_alterseach pass 50 of 50 runs under randomized settings.Version info
26.3.33.41