From 69e8133fdce30d8d5490eca64ba322a2b033f5d6 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 1 Mar 2018 09:21:15 +0300 Subject: [PATCH] Added a test by Stas Sviridov #320 --- .../00584_view_union_all.reference | 2 ++ .../0_stateless/00584_view_union_all.sql | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00584_view_union_all.reference create mode 100644 dbms/tests/queries/0_stateless/00584_view_union_all.sql diff --git a/dbms/tests/queries/0_stateless/00584_view_union_all.reference b/dbms/tests/queries/0_stateless/00584_view_union_all.reference new file mode 100644 index 00000000000..fbffd3a0d8e --- /dev/null +++ b/dbms/tests/queries/0_stateless/00584_view_union_all.reference @@ -0,0 +1,2 @@ +hello A 0 +hello ALL 0 diff --git a/dbms/tests/queries/0_stateless/00584_view_union_all.sql b/dbms/tests/queries/0_stateless/00584_view_union_all.sql new file mode 100644 index 00000000000..3460352e809 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00584_view_union_all.sql @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS test.Test; + +CREATE TABLE test.Test ( + createdDate Date, + str String, + key Enum8('A' = 0, 'B' = 1, 'ALL' = 2), + a Int64 +) +ENGINE = MergeTree(createdDate, str, 8192); + +INSERT INTO test.Test VALUES ('2000-01-01', 'hello', 'A', 123); + +SET max_threads = 1; + +CREATE VIEW test.TestView AS + SELECT str, key, sumIf(a, 0) AS sum + FROM test.Test + GROUP BY str, key + + UNION ALL + + SELECT str AS str, CAST('ALL' AS Enum8('A' = 0, 'B' = 1, 'ALL' = 2)) AS key, sumIf(a, 0) AS sum + FROM test.Test + GROUP BY str; + +SELECT * FROM test.TestView; + +DROP TABLE test.TestView; +DROP TABLE test.Test;