Skip to content

Fix a possible logical error in ip_trie dictionary when key type is not String#97555

Merged
bharatnc merged 3 commits intomasterfrom
ncb/fix-logical-error-ip-address-dict
Feb 22, 2026
Merged

Fix a possible logical error in ip_trie dictionary when key type is not String#97555
bharatnc merged 3 commits intomasterfrom
ncb/fix-logical-error-ip-address-dict

Conversation

@bharatnc
Copy link
Contributor

The ip_trie dictionary read path always produces a plain ColumnString for the key regardless of the declared key type. When the key is declared as anything other than String (e.g. Nullable(String)), the mismatch between the block header type and actual column type causes a bad cast from ColumnString to ColumnNullable in SerializationNullable::enumerateStreams.

This seems to only affect direct table reads (eg. SELECT ... FROM dict) because:

  • CREATE DICTIONARYdefers loading until first access
  • dictGet()-style queries use a separate lookup path (getColumn) that never reaches keyViewGetter.

The fix validates the key type in keyViewGetter and rejects anything that is not String.

Possibly one of the related fixes for: #97454 (repro and check: #97454 (comment))

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix a possible logical error in ip_trie dictionary when key type is not String.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

@clickhouse-gh
Copy link
Contributor

clickhouse-gh bot commented Feb 21, 2026

Workflow [PR], commit [2118632]

Summary:

job_name test_name status info comment
Stateless tests (amd_tsan, parallel, 2/2) failure
02932_refreshable_materialized_views_2 FAIL cidb, issue ISSUE CREATED

@clickhouse-gh clickhouse-gh bot added the pr-bugfix Pull request with bugfix, not backported by default label Feb 21, 2026
@Algunenano Algunenano self-assigned this Feb 21, 2026
@bharatnc bharatnc requested a review from Algunenano February 22, 2026 13:08
@bharatnc bharatnc added this pull request to the merge queue Feb 22, 2026
Merged via the queue into master with commit 837324d Feb 22, 2026
146 of 148 checks passed
@bharatnc bharatnc deleted the ncb/fix-logical-error-ip-address-dict branch February 22, 2026 19:31
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Feb 22, 2026
Algunenano pushed a commit to Algunenano/ClickHouse that referenced this pull request Feb 24, 2026
…rror-ip-address-dict

Fix a possible logical error in ip_trie dictionary when key type is not String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-bugfix Pull request with bugfix, not backported by default 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