From e37e38991c34cbc2033cd27fc3e57823cf68321e Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 16 Apr 2015 12:58:47 +0300 Subject: [PATCH] dbms: added test for usage of WITH TOTALS inside JOIN [#METR-15417]. --- .../00150_with_totals_and_join.reference | 22 +++++++++++++++++++ .../00150_with_totals_and_join.sql | 4 ++++ 2 files changed, 26 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00150_with_totals_and_join.reference create mode 100644 dbms/tests/queries/0_stateless/00150_with_totals_and_join.sql diff --git a/dbms/tests/queries/0_stateless/00150_with_totals_and_join.reference b/dbms/tests/queries/0_stateless/00150_with_totals_and_join.reference new file mode 100644 index 00000000000..d809c3fa0ff --- /dev/null +++ b/dbms/tests/queries/0_stateless/00150_with_totals_and_join.reference @@ -0,0 +1,22 @@ +0 3 6 +1 12 22 +2 21 17 +3 9 0 +0 3 6 +1 12 22 +2 21 17 +3 9 0 + +0 45 0 +0 3 6 +1 12 22 +2 21 17 +3 9 0 + +0 0 45 +0 3 6 +1 12 22 +2 21 17 +3 9 0 + +0 45 45 diff --git a/dbms/tests/queries/0_stateless/00150_with_totals_and_join.sql b/dbms/tests/queries/0_stateless/00150_with_totals_and_join.sql new file mode 100644 index 00000000000..1c369da7491 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00150_with_totals_and_join.sql @@ -0,0 +1,4 @@ +SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k; +SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) USING k ORDER BY k; +SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) USING k ORDER BY k; +SELECT k, s1, s2 FROM (SELECT intDiv(number, 3) AS k, sum(number) AS s1 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) ANY LEFT JOIN (SELECT intDiv(number, 4) AS k, sum(number) AS s2 FROM (SELECT * FROM system.numbers LIMIT 10) GROUP BY k WITH TOTALS) USING k ORDER BY k;