mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Add test
This commit is contained in:
parent
e0b3283ed3
commit
bdedf1df63
19
dbms/tests/queries/0_stateless/00701_rollup.reference
Normal file
19
dbms/tests/queries/0_stateless/00701_rollup.reference
Normal file
@ -0,0 +1,19 @@
|
||||
0 120 8
|
||||
a 0 70 4
|
||||
a 1 25 2
|
||||
a 2 45 2
|
||||
b 0 50 4
|
||||
b 1 15 2
|
||||
b 2 35 2
|
||||
0 120 8
|
||||
a 0 70 4
|
||||
a 1 25 2
|
||||
a 2 45 2
|
||||
b 0 50 4
|
||||
b 1 15 2
|
||||
b 2 35 2
|
||||
|
||||
0 120 8
|
||||
120 8
|
||||
a 70 4
|
||||
b 50 4
|
17
dbms/tests/queries/0_stateless/00701_rollup.sql
Normal file
17
dbms/tests/queries/0_stateless/00701_rollup.sql
Normal file
@ -0,0 +1,17 @@
|
||||
DROP TABLE IF EXISTS test.rollup;
|
||||
CREATE TABLE test.rollup(a String, b Int32, s Int32) ENGINE = Memory;
|
||||
|
||||
INSERT INTO test.rollup VALUES('a', 1, 10);
|
||||
INSERT INTO test.rollup VALUES('a', 1, 15);
|
||||
INSERT INTO test.rollup VALUES('a', 2, 20);
|
||||
INSERT INTO test.rollup VALUES('a', 2, 25);
|
||||
INSERT INTO test.rollup VALUES('b', 1, 10);
|
||||
INSERT INTO test.rollup VALUES('b', 1, 5);
|
||||
INSERT INTO test.rollup VALUES('b', 2, 20);
|
||||
INSERT INTO test.rollup VALUES('b', 2, 15);
|
||||
|
||||
SELECT a, b, sum(s), count() from test.rollup GROUP BY ROLLUP(a, b) ORDER BY a, b;
|
||||
|
||||
SELECT a, b, sum(s), count() from test.rollup GROUP BY ROLLUP(a, b) WITH TOTALS ORDER BY a, b;
|
||||
|
||||
SELECT a, sum(s), count() from test.rollup GROUP BY ROLLUP(a) ORDER BY a;
|
Loading…
Reference in New Issue
Block a user