From 0ba8ce2d251d6c335dcd9cf2931a942c33d88b59 Mon Sep 17 00:00:00 2001 From: alesapin Date: Mon, 27 Jul 2020 19:16:43 +0300 Subject: [PATCH] Add tests for primary key clear column --- .../01416_clear_column_pk.reference | 2 ++ .../0_stateless/01416_clear_column_pk.sql | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/queries/0_stateless/01416_clear_column_pk.reference create mode 100644 tests/queries/0_stateless/01416_clear_column_pk.sql diff --git a/tests/queries/0_stateless/01416_clear_column_pk.reference b/tests/queries/0_stateless/01416_clear_column_pk.reference new file mode 100644 index 00000000000..5878ba47225 --- /dev/null +++ b/tests/queries/0_stateless/01416_clear_column_pk.reference @@ -0,0 +1,2 @@ +1000 +1000 diff --git a/tests/queries/0_stateless/01416_clear_column_pk.sql b/tests/queries/0_stateless/01416_clear_column_pk.sql new file mode 100644 index 00000000000..a549d759130 --- /dev/null +++ b/tests/queries/0_stateless/01416_clear_column_pk.sql @@ -0,0 +1,22 @@ +DROP TABLE IF EXISTS table_with_pk_clear; + +CREATE TABLE table_with_pk_clear( + key1 UInt64, + key2 String, + value1 String, + value2 String +) +ENGINE = MergeTree() +ORDER by (key1, key2); + +INSERT INTO table_with_pk_clear SELECT number, number * number, toString(number), toString(number * number) FROM numbers(1000); + +ALTER TABLE table_with_pk_clear CLEAR COLUMN key1 IN PARTITION tuple(); --{serverError 524} + +SELECT count(distinct key1) FROM table_with_pk_clear; + +ALTER TABLE table_with_pk_clear CLEAR COLUMN key2 IN PARTITION tuple(); --{serverError 524} + +SELECT count(distinct key2) FROM table_with_pk_clear; + +DROP TABLE IF EXISTS table_with_pk_clear;