2022-07-21 10:12:04 +00:00
|
|
|
-- Tags: no-backward-compatibility-check
|
|
|
|
|
2022-07-21 14:28:02 +00:00
|
|
|
DROP TABLE IF EXISTS test_table;
|
|
|
|
CREATE TABLE test_table
|
2022-07-21 10:12:04 +00:00
|
|
|
(
|
|
|
|
id UInt64,
|
2022-07-21 14:28:02 +00:00
|
|
|
value String
|
2022-07-21 10:12:04 +00:00
|
|
|
)
|
|
|
|
ENGINE = Memory;
|
|
|
|
|
2022-07-21 14:28:02 +00:00
|
|
|
DROP TABLE IF EXISTS test_lookup_table;
|
|
|
|
CREATE TABLE test_lookup_table
|
2022-07-21 10:12:04 +00:00
|
|
|
(
|
|
|
|
id UInt64,
|
|
|
|
lookup_key UInt64,
|
|
|
|
)
|
|
|
|
ENGINE = Memory;
|
|
|
|
|
2022-07-21 14:28:02 +00:00
|
|
|
INSERT INTO test_table VALUES(0, 'value_0');
|
|
|
|
|
|
|
|
INSERT INTO test_lookup_table VALUES(0, 0);
|
|
|
|
INSERT INTO test_lookup_table VALUES(1, 0);
|
|
|
|
INSERT INTO test_lookup_table VALUES(2, 0);
|
|
|
|
INSERT INTO test_lookup_table VALUES(3, 1);
|
|
|
|
INSERT INTO test_lookup_table VALUES(4, 0);
|
|
|
|
INSERT INTO test_lookup_table VALUES(5, 1);
|
|
|
|
INSERT INTO test_lookup_table VALUES(6, 0);
|
|
|
|
INSERT INTO test_lookup_table VALUES(7, 2);
|
|
|
|
INSERT INTO test_lookup_table VALUES(8, 1);
|
|
|
|
INSERT INTO test_lookup_table VALUES(9, 0);
|
|
|
|
|
|
|
|
DROP DICTIONARY IF EXISTS test_dictionary;
|
|
|
|
CREATE DICTIONARY test_dictionary
|
2022-07-21 10:12:04 +00:00
|
|
|
(
|
|
|
|
id UInt64,
|
2022-07-21 14:28:02 +00:00
|
|
|
value String
|
2022-07-21 10:12:04 +00:00
|
|
|
)
|
|
|
|
PRIMARY KEY id
|
2022-07-21 14:28:02 +00:00
|
|
|
SOURCE(CLICKHOUSE(TABLE 'test_table'))
|
2022-07-21 10:12:04 +00:00
|
|
|
LAYOUT(DIRECT());
|
|
|
|
|
2022-07-21 14:28:02 +00:00
|
|
|
SELECT id, lookup_key, dictHas('test_dictionary', lookup_key) FROM test_lookup_table ORDER BY id ASC;
|
2022-07-21 10:12:04 +00:00
|
|
|
|
2022-07-21 14:28:02 +00:00
|
|
|
DROP DICTIONARY test_dictionary;
|
|
|
|
DROP TABLE test_table;
|
|
|
|
DROP TABLE test_lookup_table;
|