ClickHouse/tests/queries/0_stateless/02366_direct_dictionary_dict_has.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1.1 KiB
MySQL
Raw Normal View History

-- Tags: no-backward-compatibility-check
2022-07-21 14:28:02 +00:00
DROP TABLE IF EXISTS test_table;
CREATE TABLE test_table
(
id UInt64,
2022-07-21 14:28:02 +00:00
value String
)
ENGINE = Memory;
2022-07-21 14:28:02 +00:00
DROP TABLE IF EXISTS test_lookup_table;
CREATE TABLE test_lookup_table
(
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
(
id UInt64,
2022-07-21 14:28:02 +00:00
value String
)
PRIMARY KEY id
2022-07-21 14:28:02 +00:00
SOURCE(CLICKHOUSE(TABLE 'test_table'))
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 14:28:02 +00:00
DROP DICTIONARY test_dictionary;
DROP TABLE test_table;
DROP TABLE test_lookup_table;