From 00d5cfbe45acdd80ae90f9ef687059b644dac206 Mon Sep 17 00:00:00 2001 From: Pavel Kartavyy Date: Thu, 3 Apr 2014 19:57:36 +0400 Subject: [PATCH] dbms: added test for alter [#METR-10550] --- .../queries/0_stateless/00030_1_alter_table.reference | 10 ++++++++++ .../tests/queries/0_stateless/00030_1_alter_table.sql | 11 +++++++++++ .../queries/0_stateless/00030_2_alter_table.reference | 7 +++++++ .../tests/queries/0_stateless/00030_2_alter_table.sql | 8 ++++++++ .../queries/0_stateless/00030_3_alter_table.reference | 1 + .../tests/queries/0_stateless/00030_3_alter_table.sql | 3 +++ 6 files changed, 40 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00030_1_alter_table.reference create mode 100644 dbms/tests/queries/0_stateless/00030_1_alter_table.sql create mode 100644 dbms/tests/queries/0_stateless/00030_2_alter_table.reference create mode 100644 dbms/tests/queries/0_stateless/00030_2_alter_table.sql create mode 100644 dbms/tests/queries/0_stateless/00030_3_alter_table.reference create mode 100644 dbms/tests/queries/0_stateless/00030_3_alter_table.sql diff --git a/dbms/tests/queries/0_stateless/00030_1_alter_table.reference b/dbms/tests/queries/0_stateless/00030_1_alter_table.reference new file mode 100644 index 00000000000..9fda58741f4 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_1_alter_table.reference @@ -0,0 +1,10 @@ +CounterID UInt32 +StartDate Date +UserID UInt32 +VisitID UInt32 +NestedColumn.A Array(UInt8) +NestedColumn.S Array(String) +ToDrop UInt32 +Added0 UInt32 +Added1 UInt32 +Added2 UInt32 diff --git a/dbms/tests/queries/0_stateless/00030_1_alter_table.sql b/dbms/tests/queries/0_stateless/00030_1_alter_table.sql new file mode 100644 index 00000000000..77d25d15cb4 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_1_alter_table.sql @@ -0,0 +1,11 @@ +DROP TABLE IF EXISTS alter_test; + +CREATE TABLE alter_test (CounterID UInt32, StartDate Date, UserID UInt32, VisitID UInt32, NestedColumn Nested(A UInt8, S String), ToDrop UInt32) ENGINE = MergeTree(StartDate, intHash32(UserID), (CounterID, StartDate, intHash32(UserID), VisitID), 8192); + +INSERT INTO alter_test VALUES (1, '2014-01-01', 2, 3, [1,2,3], ['a','b','c'], 4); + +ALTER TABLE alter_test ADD COLUMN Added0 UInt32; +ALTER TABLE alter_test ADD COLUMN Added2 UInt32; +ALTER TABLE alter_test ADD COLUMN Added1 UInt32 AFTER Added0; + +DESC TABLE alter_test; diff --git a/dbms/tests/queries/0_stateless/00030_2_alter_table.reference b/dbms/tests/queries/0_stateless/00030_2_alter_table.reference new file mode 100644 index 00000000000..8c47f345849 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_2_alter_table.reference @@ -0,0 +1,7 @@ +CounterID UInt32 +StartDate Date +UserID UInt32 +VisitID UInt32 +Added0 String +Added1 UInt32 +Added2 UInt32 diff --git a/dbms/tests/queries/0_stateless/00030_2_alter_table.sql b/dbms/tests/queries/0_stateless/00030_2_alter_table.sql new file mode 100644 index 00000000000..d6fd3cf4a4a --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_2_alter_table.sql @@ -0,0 +1,8 @@ +ALTER TABLE alter_test DROP COLUMN ToDrop; + +ALTER TABLE alter_test MODIFY COLUMN Added0 String; + +ALTER TABLE alter_test DROP COLUMN `NestedColumn.A`; +ALTER TABLE alter_test DROP COLUMN `NestedColumn.S`; + +DESC TABLE alter_test; diff --git a/dbms/tests/queries/0_stateless/00030_3_alter_table.reference b/dbms/tests/queries/0_stateless/00030_3_alter_table.reference new file mode 100644 index 00000000000..123652833e9 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_3_alter_table.reference @@ -0,0 +1 @@ +1 2014-01-01 2 3 0 0 diff --git a/dbms/tests/queries/0_stateless/00030_3_alter_table.sql b/dbms/tests/queries/0_stateless/00030_3_alter_table.sql new file mode 100644 index 00000000000..d7ecb07f159 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00030_3_alter_table.sql @@ -0,0 +1,3 @@ +SELECT * FROM alter_test; + +DROP TABLE alter_test;