2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: no-parallel, no-fasttest
|
|
|
|
|
2020-06-20 11:29:01 +00:00
|
|
|
SET send_logs_level = 'fatal';
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS database_for_dict_01018;
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DATABASE database_for_dict_01018;
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP TABLE IF EXISTS database_for_dict_01018.table_for_dict;
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE TABLE database_for_dict_01018.table_for_dict
|
2019-10-15 18:04:17 +00:00
|
|
|
(
|
|
|
|
key_column UInt64,
|
|
|
|
second_column UInt8,
|
|
|
|
third_column String
|
|
|
|
)
|
|
|
|
ENGINE = MergeTree()
|
|
|
|
ORDER BY key_column;
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
INSERT INTO database_for_dict_01018.table_for_dict VALUES (1, 100, 'Hello world');
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS db_01018;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DATABASE db_01018;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SELECT '=DICTIONARY in Ordinary DB';
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DICTIONARY IF EXISTS db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DICTIONARY db_01018.dict1
|
2019-10-11 15:22:30 +00:00
|
|
|
(
|
2019-10-16 17:06:52 +00:00
|
|
|
key_column UInt64 DEFAULT 0,
|
|
|
|
second_column UInt8 DEFAULT 1,
|
|
|
|
third_column String DEFAULT 'qqq'
|
2019-10-11 15:22:30 +00:00
|
|
|
)
|
|
|
|
PRIMARY KEY key_column
|
2020-11-17 13:24:13 +00:00
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018'))
|
2019-10-11 15:22:30 +00:00
|
|
|
LIFETIME(MIN 1 MAX 10)
|
|
|
|
LAYOUT(FLAT());
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW CREATE DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018 LIKE 'dict1';
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
EXISTS DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SELECT database, name FROM system.dictionaries WHERE name LIKE 'dict1';
|
|
|
|
|
|
|
|
SELECT '==DETACH DICTIONARY';
|
2020-09-22 11:56:40 +00:00
|
|
|
DETACH DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018 LIKE 'dict1';
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
EXISTS DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SELECT database, name FROM system.dictionaries WHERE name LIKE 'dict1';
|
|
|
|
|
|
|
|
SELECT '==ATTACH DICTIONARY';
|
2020-09-22 11:56:40 +00:00
|
|
|
ATTACH DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018 LIKE 'dict1';
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
EXISTS DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SELECT database, name FROM system.dictionaries WHERE name LIKE 'dict1';
|
|
|
|
|
|
|
|
SELECT '==DROP DICTIONARY';
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DICTIONARY IF EXISTS db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018 LIKE 'dict1';
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
EXISTS DICTIONARY db_01018.dict1;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SELECT database, name FROM system.dictionaries WHERE name LIKE 'dict1';
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS db_01018;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
DROP DATABASE IF EXISTS memory_db;
|
|
|
|
|
|
|
|
CREATE DATABASE memory_db ENGINE = Memory;
|
|
|
|
|
|
|
|
SELECT '=DICTIONARY in Memory DB';
|
|
|
|
|
|
|
|
CREATE DICTIONARY memory_db.dict2
|
|
|
|
(
|
2019-10-15 18:04:17 +00:00
|
|
|
key_column UInt64 DEFAULT 0 INJECTIVE,
|
2019-10-11 15:22:30 +00:00
|
|
|
second_column UInt8 DEFAULT 1 EXPRESSION rand() % 222,
|
|
|
|
third_column String DEFAULT 'qqq'
|
|
|
|
)
|
|
|
|
PRIMARY KEY key_column
|
2020-12-04 02:15:44 +00:00
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018'))
|
2019-10-11 15:22:30 +00:00
|
|
|
LIFETIME(MIN 1 MAX 10)
|
2021-04-24 22:03:04 +00:00
|
|
|
LAYOUT(FLAT());
|
2019-10-11 15:22:30 +00:00
|
|
|
|
2021-04-24 22:03:04 +00:00
|
|
|
SHOW CREATE DICTIONARY memory_db.dict2;
|
2019-10-11 15:22:30 +00:00
|
|
|
|
|
|
|
SHOW DICTIONARIES FROM memory_db LIKE 'dict2';
|
|
|
|
|
|
|
|
EXISTS DICTIONARY memory_db.dict2;
|
|
|
|
|
|
|
|
SELECT database, name FROM system.dictionaries WHERE name LIKE 'dict2';
|
|
|
|
|
2019-10-14 09:21:29 +00:00
|
|
|
SELECT '=DICTIONARY in Lazy DB';
|
|
|
|
|
|
|
|
DROP DATABASE IF EXISTS lazy_db;
|
|
|
|
|
|
|
|
CREATE DATABASE lazy_db ENGINE = Lazy(1);
|
|
|
|
|
|
|
|
CREATE DICTIONARY lazy_db.dict3
|
|
|
|
(
|
2019-10-15 18:04:17 +00:00
|
|
|
key_column UInt64 DEFAULT 0 INJECTIVE,
|
2019-10-14 09:21:29 +00:00
|
|
|
second_column UInt8 DEFAULT 1 EXPRESSION rand() % 222,
|
|
|
|
third_column String DEFAULT 'qqq'
|
|
|
|
)
|
|
|
|
PRIMARY KEY key_column, second_column
|
2020-12-04 02:15:44 +00:00
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018'))
|
2019-10-14 09:21:29 +00:00
|
|
|
LIFETIME(MIN 1 MAX 10)
|
2021-04-24 22:03:04 +00:00
|
|
|
LAYOUT(COMPLEX_KEY_HASHED()); --{serverError 1}
|
2019-10-14 09:21:29 +00:00
|
|
|
|
|
|
|
DROP DATABASE IF EXISTS lazy_db;
|
|
|
|
|
2019-10-14 09:52:43 +00:00
|
|
|
SELECT '=DROP DATABASE WITH DICTIONARY';
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DATABASE db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DICTIONARY db_01018.dict4
|
2019-10-14 09:52:43 +00:00
|
|
|
(
|
|
|
|
key_column UInt64 DEFAULT 0,
|
|
|
|
second_column UInt8 DEFAULT 1,
|
|
|
|
third_column String DEFAULT 'qqq'
|
|
|
|
)
|
|
|
|
PRIMARY KEY key_column
|
2020-12-04 02:15:44 +00:00
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018'))
|
2019-10-14 09:52:43 +00:00
|
|
|
LIFETIME(MIN 1 MAX 10)
|
|
|
|
LAYOUT(FLAT());
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DATABASE db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
CREATE DICTIONARY db_01018.dict4
|
2019-10-14 09:52:43 +00:00
|
|
|
(
|
|
|
|
key_column UInt64 DEFAULT 0,
|
|
|
|
second_column UInt8 DEFAULT 1,
|
|
|
|
third_column String DEFAULT 'qqq'
|
|
|
|
)
|
|
|
|
PRIMARY KEY key_column
|
2020-12-04 02:15:44 +00:00
|
|
|
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict_01018'))
|
2019-10-14 09:52:43 +00:00
|
|
|
LIFETIME(MIN 1 MAX 10)
|
|
|
|
LAYOUT(FLAT());
|
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
SHOW DICTIONARIES FROM db_01018;
|
2019-10-14 09:52:43 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS db_01018;
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP TABLE IF EXISTS database_for_dict_01018.table_for_dict;
|
2019-10-15 18:04:17 +00:00
|
|
|
|
2020-09-22 11:56:40 +00:00
|
|
|
DROP DATABASE IF EXISTS database_for_dict_01018;
|
2020-02-11 18:05:08 +00:00
|
|
|
DROP DATABASE IF EXISTS memory_db;
|