Fix exception in concat with Variant containing LowCardinality#97654
Merged
alexey-milovidov merged 4 commits intomasterfrom Feb 23, 2026
Merged
Fix exception in concat with Variant containing LowCardinality#97654alexey-milovidov merged 4 commits intomasterfrom
alexey-milovidov merged 4 commits intomasterfrom
Conversation
The `concat` function's `executeFormatImpl` called `convertToFullIfNeeded` which, after it was made recursive in #97493, strips `LowCardinality` from inside compound column types like `Variant`. However, the argument type is not updated to match, so `SerializationLowCardinality` tries to cast a non-LC column, triggering a LOGICAL_ERROR exception in debug builds. Fix by using only top-level column conversions (Const, Sparse, LowCardinality) instead of the recursive `convertToFullIfNeeded`, keeping the column structure consistent with the type's serialization. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97581&sha=320e7c9d8876b04a971bd26214b9ac0ab433c250&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
nihalzp
approved these changes
Feb 23, 2026
robot-ch-test-poll2
added a commit
that referenced
this pull request
Feb 23, 2026
Cherry pick #97654 to 25.3: Fix exception in concat with Variant containing LowCardinality
This was referenced Feb 23, 2026
Closed
robot-ch-test-poll2
added a commit
that referenced
this pull request
Feb 23, 2026
Cherry pick #97654 to 25.8: Fix exception in concat with Variant containing LowCardinality
This was referenced Feb 23, 2026
Closed
robot-ch-test-poll2
added a commit
that referenced
this pull request
Feb 23, 2026
Cherry pick #97654 to 25.11: Fix exception in concat with Variant containing LowCardinality
robot-ch-test-poll2
added a commit
that referenced
this pull request
Feb 23, 2026
Cherry pick #97654 to 25.12: Fix exception in concat with Variant containing LowCardinality
This was referenced Feb 23, 2026
Closed
robot-ch-test-poll2
added a commit
that referenced
this pull request
Feb 23, 2026
Cherry pick #97654 to 26.1: Fix exception in concat with Variant containing LowCardinality
clickhouse-gh bot
added a commit
that referenced
this pull request
Feb 23, 2026
Backport #97654 to 26.1: Fix exception in concat with Variant containing LowCardinality
This was referenced Feb 24, 2026
Algunenano
added a commit
to Algunenano/ClickHouse
that referenced
this pull request
Feb 24, 2026
…ntaining `LowCardinality` Same bug as fixed for `concat` in ClickHouse#97654: `convertToFullIfNeeded` recursively strips `LowCardinality` from inside compound column types like `Variant`, but the argument type is not updated to match, so `SerializationLowCardinality` tries to cast a non-LC column, triggering a LOGICAL_ERROR exception in debug builds. Fix by using only top-level column conversions (Const, Sparse, LowCardinality) instead of the recursive `convertToFullIfNeeded`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 task
Algunenano
pushed a commit
to Algunenano/ClickHouse
that referenced
this pull request
Feb 24, 2026
…t-low-cardinality Fix exception in concat with Variant containing LowCardinality
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.
Summary
Bad cast from type DB::ColumnVector<char8_t> to DB::ColumnLowCardinality) in theconcatfunction when an argument is an array containing aVarianttype withLowCardinalityinside (e.g.,concat('a', [(1, 2), toLowCardinality(3)]))convertToFullIfNeededrecursive — it now stripsLowCardinalityfrom inside compound column types likeColumnVariant, but the argument type is not updated to match, causing a type/column mismatch during serializationconvertToFullIfNeededCI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97581&sha=320e7c9d8876b04a971bd26214b9ac0ab433c250&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%29
Test plan
03987_concat_variant_low_cardinalitywith reproducer queriesconcatfunctionality is not affectedChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix LOGICAL_ERROR exception in
concatwhen an argument contains aVarianttype withLowCardinalityinside.🤖 Generated with Claude Code