Repository navigation
Fix logical error in CrossTab aggregate functions during cross state variant merge - #104277
Conversation
|
Workflow [PR], commit [b9fe24d] Summary: ❌
AI ReviewSummaryThis PR fixes incorrect handling when merging aggregate states with different internal ClickHouse Rules
Final Verdict
|
LLVM Coverage Report
Changed lines: 96.36% (53/55) · Uncovered code |
|
@groeneai Investigate why the AST Fuzzer is failing. |
|
@nihalzp — investigated. Unrelated to your fix. This is a chronic trunk bug, safe to ignore on this PR. Failing test: Stack frame: Failing query (excerpt): SELECT tuple(tuple(number), (... ((SELECT (tuple(number), toNullable(toInt256(100)), -2147483648)), tuple(*), ...))) FROM ...Note the CIDB cross-PR data (30d, STID 3262-4259/40aa/3b6a/3ec5 family):
7 unrelated PRs + 2 master hits. Diverse PR authors / changesets — none touch CrossTab. Root cause (already isolated, deterministic local repro): Canonical fix: PR #100365 by @alexey-milovidov ("Fix exception in correlated subquery with Recommendation: Just re-run the |
3fb6558
…erge The cramersV, cramersVBiasCorrected, contingency and theilsU aggregate functions have two internal state representations (Aggregation and Window) that share the same type name. PR ClickHouse#104277 fixed the crash when a scalar AggregateFunction column carrying one representation is cast into a Variant whose same-named slot expects the other (createColumnToVariantWrapper). The Variant to Variant cast path (createVariantToVariantWrapper) had the same gap: it mapped variant slots purely by name and copied their subcolumns verbatim, so a subcolumn carrying one representation could be placed under a slot expecting the other. Chained set operations (EXCEPT / INTERSECT) and nested UNION ALL produce exactly this Variant to Variant cast, so a later read of the state (finalization, serialization, or the -Merge combinator) then interpreted the bytes with the wrong layout and the server aborted. Convert the subcolumn to the destination representation in createVariantToVariantWrapper when an old and a new slot match by name but differ (equals() is false), reusing the existing AggregateFunction representation-converting cast, instead of copying it as-is. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…erge The cramersV, cramersVBiasCorrected, contingency and theilsU aggregate functions have two internal state representations (Aggregation and Window) that share the same type name. PR ClickHouse#104277 fixed the crash when a scalar AggregateFunction column carrying one representation is cast into a Variant whose same-named slot expects the other (createColumnToVariantWrapper). The Variant to Variant cast path (createVariantToVariantWrapper) had the same gap: it mapped variant slots purely by name and copied their subcolumns verbatim, so a subcolumn carrying one representation could be placed under a slot expecting the other. Chained set operations (EXCEPT / INTERSECT) and nested UNION ALL produce exactly this Variant to Variant cast, so a later read of the state (finalization, serialization, or the -Merge combinator) then interpreted the bytes with the wrong layout and the server aborted. Convert the subcolumn to the destination representation in createVariantToVariantWrapper when an old and a new slot match by name but differ (equals() is false), reusing the existing AggregateFunction representation-converting cast, instead of copying it as-is. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The following query has logical error in debug build:
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not needed. This bug is not present in any release yet. Closes #104183.
Documentation entry for user-facing changes
Version info
26.5.1.423