Skip to content

Fix logical error in KeyCondition with LowCardinality key column - #97675

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
nihalzp:fix-dag-apply-exception
Feb 23, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
nihalzp:fix-dag-apply-exception

Conversation

@nihalzp

@nihalzp nihalzp commented Feb 23, 2026 •

Copy link
Copy Markdown
Member

Simplified version of #97669.

Additionally, this PR also fixes another potential bug where convertToFullIfNeeded recursively remove LC but for type, we still used removeLowCardinality causing mismatch. For example, the following query would crash because of this:

SET allow_suspicious_low_cardinality_types = 1;

CREATE TABLE t_nested2
(
    d Array(LowCardinality(DateTime('America/New_York')))
)
ENGINE = MergeTree
ORDER BY CAST(d, 'Array(DateTime(\'America/New_York\'))')
SETTINGS index_granularity = 1;

INSERT INTO t_nested2 VALUES ([toDateTime(1730611800, 'America/New_York')]);

SELECT toUnixTimestamp(d[1])
FROM t_nested2
WHERE d = CAST(
    [toDateTime(1730611800, 'America/New_York')],
    'Array(LowCardinality(DateTime(\'America/New_York\')))'
);

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.2.1.1064

@clickhouse-gh

clickhouse-gh Bot commented Feb 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [f6c5b2b]

Summary: ✅

@alexey-milovidov alexey-milovidov self-assigned this Feb 23, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Feb 23, 2026
Merged via the queue into ClickHouse:master with commit ed89028 Feb 23, 2026
144 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants