ClickHouse/tests/queries/0_stateless/02188_parser_dictionary_primary_key.sql
2022-01-29 15:50:10 +00:00

66 lines
1.7 KiB
SQL

DROP TABLE IF EXISTS 02188_test_dictionary_source;
CREATE TABLE 02188_test_dictionary_source
(
id UInt64,
value String
)
ENGINE=TinyLog;
INSERT INTO 02188_test_dictionary_source VALUES (0, 'Value');
DROP DICTIONARY IF EXISTS 02188_test_dictionary_simple_primary_key;
CREATE DICTIONARY 02188_test_dictionary_simple_primary_key
(
id UInt64,
value String
)
PRIMARY KEY id
SOURCE(CLICKHOUSE(TABLE '02188_test_dictionary_source'))
LAYOUT(DIRECT());
SELECT 'Dictionary output';
SELECT * FROM 02188_test_dictionary_simple_primary_key;
DROP DICTIONARY 02188_test_dictionary_simple_primary_key;
CREATE DICTIONARY 02188_test_dictionary_simple_primary_key
(
id UInt64,
value String
)
PRIMARY KEY (id)
SOURCE(CLICKHOUSE(TABLE '02188_test_dictionary_source'))
LAYOUT(DIRECT());
SELECT 'Dictionary output';
SELECT * FROM 02188_test_dictionary_simple_primary_key;
DROP DICTIONARY 02188_test_dictionary_simple_primary_key;
DROP DICTIONARY IF EXISTS 02188_test_dictionary_complex_primary_key;
CREATE DICTIONARY 02188_test_dictionary_complex_primary_key
(
id UInt64,
value String
)
PRIMARY KEY id, value
SOURCE(CLICKHOUSE(TABLE '02188_test_dictionary_source'))
LAYOUT(COMPLEX_KEY_DIRECT());
SELECT 'Dictionary output';
SELECT * FROM 02188_test_dictionary_complex_primary_key;
DROP DICTIONARY 02188_test_dictionary_complex_primary_key;
CREATE DICTIONARY 02188_test_dictionary_complex_primary_key
(
id UInt64,
value String
)
PRIMARY KEY (id, value)
SOURCE(CLICKHOUSE(TABLE '02188_test_dictionary_source'))
LAYOUT(COMPLEX_KEY_DIRECT());
SELECT 'Dictionary output';
SELECT * FROM 02188_test_dictionary_complex_primary_key;
DROP DICTIONARY 02188_test_dictionary_complex_primary_key;
DROP TABLE 02188_test_dictionary_source;