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;