Skip to content

Redis simple dictionaries support direct layout - #106501

Merged
vdimir merged 9 commits into
masterfrom
vdimir/redis-dict-simple-layout
Jun 12, 2026
Merged

vdimir merged 9 commits into
masterfrom
vdimir/redis-dict-simple-layout

Conversation

@vdimir

@vdimir vdimir commented Jun 4, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix

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

  • Fixed a Bad cast exception for Redis dictionaries that use STORAGE_TYPE 'simple' with a cache/direct layout and a single string (complex) key; such dictionaries now work, and composite keys over simple storage report a clear error.

Version info

  • Merged into: 26.6.1.696

@clickhouse-gh

clickhouse-gh Bot commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [36a9077]

Summary: ✅


AI Review

Summary

This PR fixes Redis dictionaries backed by STORAGE_TYPE 'simple' for one-column complex-key layouts by sending a flat MGET key list, rejects unsupported composite keys for simple storage, updates the Redis source docs, and expands Redis integration coverage. The implementation path looks coherent, but one updated docs sentence now promises broader integer-key support than the current code actually provides.

Findings

⚠️ Majors

  • [docs/en/sql-reference/statements/create/dictionary/sources/redis.md:51] The docs say Redis dictionary key columns can be any integer or string type, but the current code still builds an ExternalResultDescription for the key column and the new test asserts that UInt256 reaches the Unsupported type UInt256 exception. Users reading this reference will expect UInt128/UInt256 keys to work. Narrow the wording to the actual supported integer key types, such as Int8...Int64 and UInt8...UInt64, or reject wide integer keys during dictionary creation.
Final Verdict

Status: ⚠️ Request changes

Minimum required action: clarify the Redis dictionary source docs so the documented integer key support matches the implementation.

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Jun 4, 2026
@vdimir
vdimir force-pushed the vdimir/redis-dict-simple-layout branch from bca3992 to f7e10b7 Compare June 9, 2026 14:27
@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default and removed pr-improvement Pull request with some product improvements labels Jun 9, 2026
@vdimir
vdimir requested a review from azat June 10, 2026 13:21
dict_struct.key->size());

const auto & key = dict_struct.key->front();
if (!isInteger(key.type) && !isString(key.type))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we allow {U,}Int128{,256} here, looks like they will be wrapped with quotes, will it work?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wide ints fall under isIntegers, but seems suck keys forbdden in
https://github.com/ClickHouse/ClickHouse/blob/master/src/Core/ExternalResultDescription.cpp which is checked in RedisSource

description.init(*sample_block);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a testcase 36a9077

| `host` | The Redis host. |
| `port` | The port on the Redis server. |
| `storage_type` | The structure of internal Redis storage using for work with keys. `simple` is for simple sources and for hashed single key sources, `hash_map` is for hashed sources with two keys. Ranged sources and cache sources with complex key are unsupported. Default value is `simple`. Optional. |
| `storage_type` | The structure of the internal Redis storage used to work with keys. `simple` uses a flat key-value map and supports simple-key layouts as well as single-column complex-key layouts (such as `complex_key_cache` and `complex_key_direct`). `hash_map` uses a Redis hash and is required for composite complex keys; it expects exactly two key columns. Key columns must be of integer or string type. Ranged layouts are unsupported. Default value is `simple`. Optional. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overstates the supported key types. The code path still builds an ExternalResultDescription for the key column, and the new test asserts that UInt256 reaches Unsupported type UInt256, so users reading "integer" here will expect UInt128/UInt256 keys to work even though they do not. Please narrow this to the actual supported integer key types, for example Int8...Int64 and UInt8...UInt64, or reject wide integer keys at dictionary creation if they should remain unsupported.

@clickhouse-gh

clickhouse-gh Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.60% 84.60% +0.00%
Functions 92.30% 92.30% +0.00%
Branches 77.20% 77.20% +0.00%

Changed lines: Changed C/C++ lines covered by tests: 32/42 (76.19%) | Lost baseline coverage: none · Uncovered code

Full report · Diff report

@vdimir
vdimir added this pull request to the merge queue Jun 12, 2026
Merged via the queue into master with commit a763677 Jun 12, 2026
166 checks passed
@vdimir
vdimir deleted the vdimir/redis-dict-simple-layout branch June 12, 2026 10:17
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