Repository navigation
Fix mismatched -Tuple combinator state name when a nulls-action modifier is applied under nested combinators - #111570
Conversation
…e names The `-Tuple` combinator names its shared state via `getAssociatedNameByNullsAction`, but the `respect_nulls` / `ignore_nulls` maps hold only base aggregate names. When the nested name itself carries further combinator suffixes (e.g. `anyRespectNullsStateTuple` nests `anyRespectNullsState`), the lookup missed and the name stayed unadjusted, while `getImpl` applied the nulls action at the base of the chain when instantiating the elements. The state type name then identified a different function than the elements actually held, and a `-State` type-name round-trip (shard to initiator in a distributed query) reconstructed a mismatched function: `CANNOT_CONVERT_TYPE` in the checked path, and a logical error `Bad cast from type DB::ColumnAggregateFunction to DB::ColumnNullable` (or an invalid memory access in the state destructor under `WITH TOTALS`) when the check was bypassed. Fix: when the name is not a registered base function, strip the combinator suffix, adjust the nested name for the action recursively, and re-append the suffix. Follow-up to the same-shaped base-name fix in #110930. Found by AST fuzzer: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110105&sha=cdc8066194937d0e1b72ab104a00dac0b285d2b3&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
|
Workflow [PR], commit [a78094f] Summary: ✅
AI ReviewSummaryThis PR fixes the Final VerdictStatus: ✅ Approve |
…r-nested-suffix-nulls-action
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111570&sha=9da0bb63238fd12de7a1c20b069635e06565a0b5&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20distributed%20plan%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The run hit server-wide memory pressure (RSS 43 GiB, |
|
@alexey-milovidov Confirmed: unrelated, server-wide host-OOM. Not caused by this PR. Evidence (this run: Stateless tests (amd_asan_ubsan, distributed plan, parallel)):
The 6 failing tests are all innocent victims (one more than listed above: Fixes:
No new PR needed here beyond the in-progress #111513; the rest is host-OOM co-scheduling covered by #110503/#110574. |
|
The remaining red — Upgrade check (amd_release) — is unrelated to this PR:
Once those merge, an update of this branch should clear the check. |
…r-nested-suffix-nulls-action
…r-nested-suffix-nulls-action
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111570&sha=6ac7b754d536ff5988ff1fe348e22a810f1ba016&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20WasmEdge%2C%20parallel%2C%202%2F3%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The shard died from a server abort on a logical error The other red, Upgrade check (amd_release) |
|
Confirmed at head Server log ( Root cause: Fix already in progress, so no new PR is needed:
|
…r-nested-suffix-nulls-action
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111570&sha=bd189239c8b922391952fb7391ce1f32bea7f0bd&name_0=PR&name_1=Stress%20test%20%28arm_debug%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The only remaining red is Known related items: issue #111421, issue #107951 (AST-fuzzer-internal-path assertions, I merged |
|
The fix is in progress: #109023 (one-line change in Ground truth from
The On the 07-24 spike: it is not a new regression, it is the same pre-existing class being fed to the fuzzer far more often. The trigger is #111059 (merged 2026-07-24 08:39 UTC, 3993b0f) through its new test So no separate PR is needed for this red; #109023 is the fix for the family and is mergeable, awaiting review. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 20/25 (80.00%) · Uncovered code |
The
-Tuplecombinator names its shared state viagetAssociatedNameByNullsAction, but therespect_nulls/ignore_nullsmaps hold only base aggregate names. When the nested name itself still carries combinator suffixes (e.g.anyRespectNullsStateTuplenestsanyRespectNullsState), the lookup missed and the shared name stayed unadjusted, whilegetImplapplied the nulls action at the base of the chain when instantiating the tuple elements. The state type name then identified a different function than the elements actually held, and a-Statetype-name round-trip (shard to initiator in a distributed query) reconstructed a mismatched function:CANNOT_CONVERT_TYPEin the checked path — with a confusing message where both printed types look identical — and a logical errorBad cast from type DB::ColumnAggregateFunction to DB::ColumnNullable(or an invalid memory access in the state destructor underWITH TOTALS) when the check was bypassed.The fix: when the name passed to
getAssociatedNameByNullsActionis not a registered base function, strip the combinator suffix, adjust the nested name for the action recursively, and re-append the suffix. Base function names whose tail merely looks like a combinator suffix (e.g.sumMap) are not stripped. This is a follow-up to the same-shaped base-name fix in #110930.Minimal reproducer (previously
CANNOT_CONVERT_TYPE):and the fuzzed shape with a longer chain under
-OrDefaultaborted the server in the state destructor.Found by AST fuzzer on an unrelated PR: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110105&sha=cdc8066194937d0e1b72ab104a00dac0b285d2b3&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29
Related: #110930
Related: #110105
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed an exception (
CANNOT_CONVERT_TYPEor a logical error) in distributed queries using the-Tuplecombinator with aRESPECT NULLS/IGNORE NULLSmodifier under nested combinators, e.g.anyRespectNullsStateTuple(...) IGNORE NULLS.