From db47dcf14fdd4122ba06b3ab6479a13ebe7b8930 Mon Sep 17 00:00:00 2001 From: Nikolai Kochetov Date: Mon, 25 Oct 2021 11:18:00 +0300 Subject: [PATCH] Added test. --- ...er_table_alter_block_structure_2.reference | 3 +++ ...6_buffer_table_alter_block_structure_2.sql | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.reference create mode 100644 tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.sql diff --git a/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.reference b/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.reference new file mode 100644 index 00000000000..1f90610041b --- /dev/null +++ b/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.reference @@ -0,0 +1,3 @@ +2020-01-01 00:05:00 +2020-01-01 00:05:00 +2020-01-01 00:06:00 hello diff --git a/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.sql b/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.sql new file mode 100644 index 00000000000..8862037c82b --- /dev/null +++ b/tests/queries/0_stateless/01506_buffer_table_alter_block_structure_2.sql @@ -0,0 +1,25 @@ +DROP TABLE IF EXISTS buf_dest; +DROP TABLE IF EXISTS buf; + +CREATE TABLE buf_dest (timestamp DateTime) +ENGINE = MergeTree PARTITION BY toYYYYMMDD(timestamp) +ORDER BY (timestamp); + +CREATE TABLE buf (timestamp DateTime) Engine = Buffer(currentDatabase(), buf_dest, 16, 0.1, 0.1, 2000000, 20000000, 100000000, 300000000);; + +INSERT INTO buf (timestamp) VALUES (toDateTime('2020-01-01 00:05:00')); + +--- wait for buffer to flush +SELECT sleep(1) from numbers(1) settings max_block_size=1 format Null; + +ALTER TABLE buf_dest ADD COLUMN s String; +ALTER TABLE buf ADD COLUMN s String; + +SELECT * FROM buf; + +INSERT INTO buf (timestamp, s) VALUES (toDateTime('2020-01-01 00:06:00'), 'hello'); + +SELECT * FROM buf ORDER BY timestamp; + +DROP TABLE IF EXISTS buf; +DROP TABLE IF EXISTS buf_dest;