mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 09:22:05 +00:00
add comments and functional test
This commit is contained in:
parent
bc16cc59ff
commit
72dd039d1c
@ -54,6 +54,9 @@ public:
|
||||
bool created_from_ddl)>;
|
||||
|
||||
bool isComplex(const std::string & layout_type) const;
|
||||
|
||||
/// if the argument `layout_type` is not complex layout and has corresponding complex layout,
|
||||
/// change `layout_type` to corresponding complex and return true; otherwise do nothing and return false.
|
||||
bool convertToComplex(std::string & layout_type) const;
|
||||
|
||||
void registerLayout(const std::string & layout_type, LayoutCreateFunction create_layout, bool is_layout_complex, bool has_layout_complex = true);
|
||||
|
@ -0,0 +1,4 @@
|
||||
dict_flat_simple Flat
|
||||
dict_hashed_simple Hashed
|
||||
dict_hashed_complex ComplexKeyHashed
|
||||
dict_hashed_simple_auto_convert ComplexKeyHashed
|
@ -0,0 +1,29 @@
|
||||
DROP DICTIONARY IF EXISTS dict_flat_simple;
|
||||
DROP DICTIONARY IF EXISTS dict_hashed_simple;
|
||||
DROP DICTIONARY IF EXISTS dict_hashed_complex;
|
||||
DROP DICTIONARY IF EXISTS dict_hashed_simple_auto_convert;
|
||||
DROP TABLE IF EXISTS dict_data;
|
||||
|
||||
CREATE TABLE dict_data (v0 UInt16, v1 UInt16, v2 UInt16, v3 UInt16, v4 UInt16) engine=Memory() AS SELECT number, number%65535, number%65535, number%6553, number%655355 FROM numbers(100);
|
||||
|
||||
CREATE DICTIONARY dict_flat_simple (v0 UInt16, v1 UInt16, v2 UInt16) PRIMARY KEY v0 SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(0) LAYOUT(flat());
|
||||
SYSTEM RELOAD DICTIONARY dict_flat_simple;
|
||||
SELECT name, type FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_flat_simple';
|
||||
DROP DICTIONARY dict_flat_simple;
|
||||
|
||||
CREATE DICTIONARY dict_hashed_simple (v0 UInt16, v1 UInt16, v2 UInt16) PRIMARY KEY v0 SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(0) LAYOUT(hashed());
|
||||
SYSTEM RELOAD DICTIONARY dict_hashed_simple;
|
||||
SELECT name, type FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_hashed_simple';
|
||||
DROP DICTIONARY dict_hashed_simple;
|
||||
|
||||
CREATE DICTIONARY dict_hashed_complex (v0 UInt16, v1 UInt16, v2 UInt16) PRIMARY KEY v0,v1 SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(0) LAYOUT(complex_key_hashed());
|
||||
SYSTEM RELOAD DICTIONARY dict_hashed_complex;
|
||||
SELECT name, type FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_hashed_complex';
|
||||
DROP DICTIONARY dict_hashed_complex;
|
||||
|
||||
CREATE DICTIONARY dict_hashed_simple_auto_convert (v0 UInt16, v1 UInt16, v2 UInt16) PRIMARY KEY v0,v1 SOURCE(CLICKHOUSE(TABLE 'dict_data')) LIFETIME(0) LAYOUT(hashed());
|
||||
SYSTEM RELOAD DICTIONARY dict_hashed_simple_auto_convert;
|
||||
SELECT name, type FROM system.dictionaries WHERE database = currentDatabase() AND name = 'dict_hashed_simple_auto_convert';
|
||||
DROP DICTIONARY dict_hashed_simple_auto_convert;
|
||||
|
||||
DROP TABLE dict_data;
|
Loading…
Reference in New Issue
Block a user