From f70a704e2cd8ee4ecd5b7b13d064fb41e2d0ad10 Mon Sep 17 00:00:00 2001 From: Maksim Kita Date: Mon, 25 Jan 2021 21:22:27 +0300 Subject: [PATCH] Added test --- ...dictionary_create_key_expression.reference | 8 ++++ ...01670_dictionary_create_key_expression.sql | 40 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/queries/0_stateless/01670_dictionary_create_key_expression.reference create mode 100644 tests/queries/0_stateless/01670_dictionary_create_key_expression.sql diff --git a/tests/queries/0_stateless/01670_dictionary_create_key_expression.reference b/tests/queries/0_stateless/01670_dictionary_create_key_expression.reference new file mode 100644 index 00000000000..eb246761f9c --- /dev/null +++ b/tests/queries/0_stateless/01670_dictionary_create_key_expression.reference @@ -0,0 +1,8 @@ +Simple +5791441145865411458 Test2 +3450587330153346914 Test1 +3111929972906540512 Test3 +Complex +3111929972906540512 5 Test3 +5791441145865411458 5 Test2 +3450587330153346914 5 Test1 diff --git a/tests/queries/0_stateless/01670_dictionary_create_key_expression.sql b/tests/queries/0_stateless/01670_dictionary_create_key_expression.sql new file mode 100644 index 00000000000..2d75764c0fa --- /dev/null +++ b/tests/queries/0_stateless/01670_dictionary_create_key_expression.sql @@ -0,0 +1,40 @@ +CREATE DATABASE database_dictionary_test_key_expression; + +CREATE TABLE database_dictionary_test_key_expression.test_for_dictionary (value String) ENGINE=TinyLog; +INSERT INTO database_dictionary_test_key_expression.test_for_dictionary VALUES ('Test1'), ('Test2'), ('Test3'); + +SELECT 'Simple'; + +CREATE DICTIONARY database_dictionary_test_key_expression.test_query_log_dictionary_simple +( + `value_id` UInt64 EXPRESSION cityHash64(value), + `value` String +) +PRIMARY KEY value_id +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'test_for_dictionary' DB 'database_dictionary_test_key_expression')) +LIFETIME(MIN 1 MAX 10) +LAYOUT(HASHED()); + +SELECT * FROM database_dictionary_test_key_expression.test_query_log_dictionary_simple; + +DROP DICTIONARY IF EXISTS database_dictionary_test_key_expression.test_query_log_dictionary_simple; + +SELECT 'Complex'; + +CREATE DICTIONARY database_dictionary_test_key_expression.test_query_log_dictionary_complex +( + `value_id` UInt64 EXPRESSION cityHash64(value), + `value_length` UInt64 EXPRESSION length(value), + `value` String +) +PRIMARY KEY value_id, value_length +SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'test_for_dictionary' DB 'database_dictionary_test_key_expression')) +LIFETIME(MIN 1 MAX 10) +LAYOUT(COMPLEX_KEY_HASHED()); + +SELECT * FROM database_dictionary_test_key_expression.test_query_log_dictionary_complex; + +DROP DICTIONARY IF EXISTS database_dictionary_test_key_expression.test_query_log_dictionary_complex; + +DROP TABLE IF EXISTS database_dictionary_test_key_expression.test_for_dictionary; +DROP DATABASE IF EXISTS database_dictionary_test_key_expression;