Repository navigation
Fix exception in applyDeterministicDagToColumn with LowCardinality key column - #97669
Closed
alexey-milovidov wants to merge 1 commit into
Closed
alexey-milovidov wants to merge 1 commit into
alexey-milovidov wants to merge 1 commit into
Conversation
Contributor
|
Workflow [PR], commit [55131b9] Summary: ⏳
|
alexey-milovidov
marked this pull request as draft
February 22, 2026 22:03
alexey-milovidov
force-pushed
the
fix-has-low-cardinality-key-condition
branch
from
February 22, 2026 22:03
f602040 to
17d5c7c
Compare
…key column The `ExpressionActions` DAG built from the key expression retains the original types, which may include LowCardinality. Functions like `CAST` handle LowCardinality internally and expect to receive LowCardinality columns. However, `applyDeterministicDagToColumn` strips LowCardinality from the input column and type before executing the DAG, causing a type mismatch that leads to "Bad cast from ColumnVector to ColumnLowCardinality" exception. Fix by re-wrapping the column in LowCardinality before executing the DAG when `dag.input_type` has LowCardinality. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97568&sha=9785d6ea5d327f0a7671c45dada310eb44e63044&name_0=PR&name_1=AST%20fuzzer%20%28amd_msan%29 Co-Authored-By: Claude Opus 4.6 <[email protected]>
alexey-milovidov
force-pushed
the
fix-has-low-cardinality-key-condition
branch
from
February 22, 2026 22:04
17d5c7c to
55131b9
Compare
1 task
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.
See #97668.
Summary
ColumnVector<unsigned int>toColumnLowCardinality" exception inapplyDeterministicDagToColumnwhenhas()is used with a LowCardinality column whose ORDER BY key involves aCAST.ExpressionActionsDAG from the key expression retains LowCardinality types, butapplyDeterministicDagToColumnstrips LowCardinality from the input before executing it, causing a type mismatch.dag.input_typeis LowCardinality.Reproducer found by AST fuzzer:
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97568&sha=9785d6ea5d327f0a7671c45dada310eb44e63044&name_0=PR&name_1=AST%20fuzzer%20%28amd_msan%29
#97568
Test plan
03402_has_low_cardinality_key_conditionChangelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
🤖 Generated with Claude Code