mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
allow to use direct layout for dictionaries with complex keys
This commit is contained in:
parent
c1a5e69e41
commit
424dd3147c
@ -593,7 +593,7 @@ void registerDictionaryComplexKeyDirect(DictionaryFactory & factory)
|
|||||||
|
|
||||||
return std::make_unique<ComplexKeyDirectDictionary>(dict_id, dict_struct, std::move(source_ptr));
|
return std::make_unique<ComplexKeyDirectDictionary>(dict_id, dict_struct, std::move(source_ptr));
|
||||||
};
|
};
|
||||||
factory.registerLayout("complex_key_direct", create_layout, false);
|
factory.registerLayout("complex_key_direct", create_layout, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
qqq
|
||||||
|
aaa
|
||||||
|
ccc
|
||||||
|
qqq
|
||||||
|
1
|
@ -0,0 +1,33 @@
|
|||||||
|
DROP DATABASE IF EXISTS db_01526;
|
||||||
|
|
||||||
|
CREATE DATABASE db_01526;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS db_01526.table_for_dict1;
|
||||||
|
|
||||||
|
CREATE TABLE db_01526.table_for_dict1
|
||||||
|
(
|
||||||
|
key_column UInt64,
|
||||||
|
second_column UInt64,
|
||||||
|
third_column String
|
||||||
|
)
|
||||||
|
ENGINE = MergeTree()
|
||||||
|
ORDER BY (key_column, second_column);
|
||||||
|
|
||||||
|
INSERT INTO db_01526.table_for_dict1 VALUES (1, 2, 'aaa'), (1, 3, 'bbb'), (2, 3, 'ccc');
|
||||||
|
|
||||||
|
CREATE DICTIONARY db_01526.dict1
|
||||||
|
(
|
||||||
|
key_column UInt64 DEFAULT 0,
|
||||||
|
second_column UInt64 DEFAULT 0,
|
||||||
|
third_column String DEFAULT 'qqq'
|
||||||
|
)
|
||||||
|
PRIMARY KEY key_column, second_column
|
||||||
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT 9000 USER 'default' TABLE 'table_for_dict1' PASSWORD '' DB 'db_01526'))
|
||||||
|
LAYOUT(COMPLEX_KEY_DIRECT());
|
||||||
|
|
||||||
|
SELECT dictGet('db_01526.dict1', 'third_column', (number, number + 1)) FROM numbers(4);
|
||||||
|
SELECT dictHas('db_01526.dict1', (toUInt64(1), toUInt64(3)));
|
||||||
|
|
||||||
|
DROP TABLE db_01526.table_for_dict1;
|
||||||
|
DROP DICTIONARY db_01526.dict1;
|
||||||
|
DROP DATABASE db_01526;
|
Loading…
Reference in New Issue
Block a user