mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #53560 from azat/skip-index-inverted-fix-ub
Fix possible UB in inverted indexes (experimental feature)
This commit is contained in:
commit
6fb24fe74d
@ -491,6 +491,10 @@ bool MergeTreeConditionInverted::traverseASTEquals(
|
||||
DataTypePtr const_type;
|
||||
if (argument.tryGetConstant(const_value, const_type))
|
||||
{
|
||||
auto const_data_type = WhichDataType(const_type);
|
||||
if (!const_data_type.isStringOrFixedString() && !const_data_type.isArray())
|
||||
return false;
|
||||
|
||||
key_column_num = header.getPositionByName(map_keys_index_column_name);
|
||||
key_exists = true;
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/52019
|
||||
DROP TABLE IF EXISTS tab;
|
||||
SET allow_experimental_inverted_index=1;
|
||||
CREATE TABLE tab (`k` UInt64, `s` Map(String, String), INDEX af mapKeys(s) TYPE inverted(2) GRANULARITY 1) ENGINE = MergeTree ORDER BY k SETTINGS index_granularity = 2, index_granularity_bytes = '10Mi';
|
||||
INSERT INTO tab (k) VALUES (0);
|
||||
SELECT * FROM tab PREWHERE (s[NULL]) = 'Click a03' SETTINGS allow_experimental_analyzer=1; -- { serverError ILLEGAL_TYPE_OF_COLUMN_FOR_FILTER }
|
||||
SELECT * FROM tab PREWHERE (s[1]) = 'Click a03' SETTINGS allow_experimental_analyzer=1; -- { serverError ILLEGAL_TYPE_OF_ARGUMENT }
|
||||
SELECT * FROM tab PREWHERE (s['foo']) = 'Click a03' SETTINGS allow_experimental_analyzer=1;
|
||||
DROP TABLE tab;
|
Loading…
Reference in New Issue
Block a user