Cherry pick #97493 to 26.1: Make convertToFullIfNeeded recursive for compound column types#97630
Merged
robot-ch-test-poll4 merged 7 commits intobackport/26.1/97493from Feb 22, 2026
Merged
Conversation
`IColumn::convertToFullIfNeeded` only converted the outermost column (const, replicated, sparse, low cardinality) but did not recurse into subcolumns of compound types like `ColumnTuple`, `ColumnArray`, `ColumnNullable`, etc. This caused assertion failures in debug/sanitizer builds when `Set::appendSetElements` or `MergeTreeIndexAggregatorSet::update` processed batches from different MergeTree parts that had different sparse serialization profiles for inner tuple elements. The fix uses `forEachSubcolumn` to recursively convert all inner columns, which generically handles all compound column types. Closes #97474 Closes #97335 https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97431&sha=6fe0e8c44dd5c6a12583390b4f8fc45e226a3cb4&name_0=PR&name_1=Stateless%20tests%20%28arm_asan%2C%20azure%2C%20parallel%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The test creates a MergeTree table with a Tuple column where different parts have different sparse serialization profiles for inner elements, then uses `IN` with a subquery to trigger `Set::appendSetElements` which previously failed with an assertion because `ColumnTuple` inner columns were not recursively converted from sparse to full. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The assertion in `ColumnTuple::doInsertRangeFrom` only fires when the destination is non-sparse (`ColumnVector`) and the source is sparse (`ColumnSparse`), because `ColumnSparse::doInsertRangeFrom` handles both cases. Swap insert order so the non-sparse part (all_1_1_0) is read first into `set_elements`, and the sparse part comes second. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`Set::appendSetElements` is only called when `fill_set_elements` is true, which happens when `KeyCondition` calls `buildOrderedSetInplace` for index evaluation. The IN column must be part of the ORDER BY key for this to happen. Changed `ORDER BY key` to `ORDER BY val` so that the tuple column is in the primary key and `KeyCondition` triggers the `buildOrderedSetInplace` path. Verified: aborts on unpatched debug build (exit code 134), passes on patched. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ecursive Make convertToFullIfNeeded recursive for compound column types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #97493
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job