ClickHouse/tests/queries/0_stateless/01033_dictionaries_lifetime.sql

49 lines
1.1 KiB
MySQL
Raw Normal View History

2021-09-12 12:35:27 +00:00
-- Tags: no-parallel
2020-06-20 11:29:01 +00:00
SET send_logs_level = 'fatal';
2019-11-29 18:46:26 +00:00
DROP DATABASE IF EXISTS database_for_dict;
2020-09-22 11:56:40 +00:00
CREATE DATABASE database_for_dict;
2019-11-29 18:46:26 +00:00
CREATE TABLE database_for_dict.table_for_dict
(
key_column UInt64,
second_column UInt8,
third_column String
)
ENGINE = MergeTree()
ORDER BY key_column;
INSERT INTO database_for_dict.table_for_dict VALUES (1, 100, 'Hello world');
DROP DATABASE IF EXISTS ordinary_db;
2020-09-22 11:56:40 +00:00
CREATE DATABASE ordinary_db;
2019-11-29 18:46:26 +00:00
CREATE DICTIONARY ordinary_db.dict1
(
key_column UInt64 DEFAULT 0,
second_column UInt8 DEFAULT 1,
third_column String DEFAULT 'qqq'
)
PRIMARY KEY key_column
SOURCE(CLICKHOUSE(HOST 'localhost' PORT tcpPort() USER 'default' TABLE 'table_for_dict' PASSWORD '' DB 'database_for_dict'))
2019-11-29 18:46:26 +00:00
LIFETIME(MIN 1 MAX 10)
LAYOUT(FLAT());
2019-12-01 00:40:59 +00:00
SELECT 'INITIALIZING DICTIONARY';
SELECT dictGetUInt8('ordinary_db.dict1', 'second_column', toUInt64(100500));
2021-11-02 12:58:45 +00:00
SELECT lifetime_min, lifetime_max FROM system.dictionaries WHERE database='ordinary_db' AND name = 'dict1';
2019-11-29 18:46:26 +00:00
DROP DICTIONARY IF EXISTS ordinary_db.dict1;
DROP DATABASE IF EXISTS ordinary_db;
DROP TABLE IF EXISTS database_for_dict.table_for_dict;
DROP DATABASE IF EXISTS database_for_dict;