From 6d071c430ebe8160d99450e0137ad5f89806b7fb Mon Sep 17 00:00:00 2001 From: Vitaliy Zakaznikov Date: Thu, 7 May 2020 19:39:33 +0200 Subject: [PATCH] Adding stateless test for alter rename column on a distributed table. --- ...74_alter_rename_column_distributed.reference | 4 ++++ .../01274_alter_rename_column_distributed.sql | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/queries/0_stateless/01274_alter_rename_column_distributed.reference create mode 100644 tests/queries/0_stateless/01274_alter_rename_column_distributed.sql diff --git a/tests/queries/0_stateless/01274_alter_rename_column_distributed.reference b/tests/queries/0_stateless/01274_alter_rename_column_distributed.reference new file mode 100644 index 00000000000..7ed221867c1 --- /dev/null +++ b/tests/queries/0_stateless/01274_alter_rename_column_distributed.reference @@ -0,0 +1,4 @@ +2020-01-01 hello +2020-01-01 hello +2020-01-02 hello2 +2020-01-02 hello2 diff --git a/tests/queries/0_stateless/01274_alter_rename_column_distributed.sql b/tests/queries/0_stateless/01274_alter_rename_column_distributed.sql new file mode 100644 index 00000000000..a35dc7cca56 --- /dev/null +++ b/tests/queries/0_stateless/01274_alter_rename_column_distributed.sql @@ -0,0 +1,17 @@ +DROP TABLE IF EXISTS visits; +DROP TABLE IF EXISTS visits_dist; + +CREATE TABLE visits(StartDate Date, Name String) ENGINE MergeTree ORDER BY(StartDate); +CREATE TABLE visits_dist AS visits ENGINE Distributed(test_cluster_two_shards_localhost, currentDatabase(), 'visits', rand()); + +INSERT INTO visits_dist (StartDate, Name) VALUES ('2020-01-01', 'hello'); +INSERT INTO visits_dist (StartDate, Name) VALUES ('2020-01-02', 'hello2'); + +ALTER TABLE visits RENAME COLUMN Name TO Name2; +ALTER TABLE visits_dist RENAME COLUMN Name TO Name2; + +SELECT * FROM visits_dist ORDER BY StartDate, Name2; + +DROP TABLE visits; +DROP TABLE visits_dist; +