mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
test added
This commit is contained in:
parent
0b0b91ccf4
commit
9ae9ab2e70
@ -0,0 +1,41 @@
|
||||
1 1
|
||||
1 2
|
||||
1 3
|
||||
1 4
|
||||
1 5
|
||||
1 6
|
||||
2 1
|
||||
2 2
|
||||
2 3
|
||||
2 4
|
||||
1
|
||||
2
|
||||
1 1 101 1
|
||||
1 2 102 1
|
||||
1 3 103 1
|
||||
1 4 104 1
|
||||
1 5 104 1
|
||||
1 6 105 1
|
||||
2 1 213 2
|
||||
2 2 107 2
|
||||
2 3 108 2
|
||||
2 4 109 2
|
||||
1 619 1
|
||||
2 537 2
|
||||
1 619 1
|
||||
2 537 2
|
||||
2019-05-05 00:00:00 -45363190
|
||||
2019-05-05 00:00:00 -1249512288
|
||||
2019-05-05 00:00:00 345522721
|
||||
2019-05-05 00:00:00 486601715
|
||||
2019-05-05 00:00:00 1449669396
|
||||
2019-05-05 00:00:00 45
|
||||
2019-05-06 00:00:00 46
|
||||
2019-05-07 00:00:00 47
|
||||
2019-05-08 00:00:00 48
|
||||
2019-05-09 00:00:00 49
|
||||
2019-05-05 00:00:00 0 1900940608
|
||||
2019-05-06 00:00:00 1 1857737272
|
||||
2019-05-07 00:00:00 2 1996614413
|
||||
2019-05-08 00:00:00 3 1873725230
|
||||
2019-05-09 00:00:00 4 1831412253
|
33
tests/queries/0_stateless/01291_aggregation_in_order.sql
Normal file
33
tests/queries/0_stateless/01291_aggregation_in_order.sql
Normal file
@ -0,0 +1,33 @@
|
||||
DROP TABLE IF EXISTS pk_order;
|
||||
|
||||
SET optimize_aggregation_in_order = 1;
|
||||
|
||||
CREATE TABLE pk_order(a UInt64, b UInt64, c UInt64, d UInt64) ENGINE=MergeTree() ORDER BY (a, b);
|
||||
INSERT INTO pk_order(a, b, c, d) VALUES (1, 1, 101, 1), (1, 2, 102, 1), (1, 3, 103, 1), (1, 4, 104, 1);
|
||||
INSERT INTO pk_order(a, b, c, d) VALUES (1, 5, 104, 1), (1, 6, 105, 1), (2, 1, 106, 2), (2, 1, 107, 2);
|
||||
INSERT INTO pk_order(a, b, c, d) VALUES (2, 2, 107, 2), (2, 3, 108, 2), (2, 4, 109, 2);
|
||||
|
||||
-- Order after group by in order is determined
|
||||
|
||||
SELECT a, b FROM pk_order GROUP BY a, b;
|
||||
SELECT a FROM pk_order GROUP BY a;
|
||||
|
||||
SELECT a, b, sum(c), avg(d) FROM pk_order GROUP BY a, b;
|
||||
SELECT a, sum(c), avg(d) FROM pk_order GROUP BY a;
|
||||
SELECT a, sum(c), avg(d) FROM pk_order GROUP BY -a;
|
||||
|
||||
DROP TABLE IF EXISTS pk_order;
|
||||
|
||||
CREATE TABLE pk_order (d DateTime, a Int32, b Int32) ENGINE = MergeTree ORDER BY (d, a)
|
||||
PARTITION BY toDate(d) SETTINGS index_granularity=1;
|
||||
|
||||
INSERT INTO pk_order
|
||||
SELECT toDateTime('2019-05-05 00:00:00') + INTERVAL number % 10 DAY, number, intHash32(number) from numbers(100);
|
||||
|
||||
set max_block_size = 1;
|
||||
|
||||
SELECT d, max(b) FROM pk_order GROUP BY d, a LIMIT 5;
|
||||
SELECT d, avg(a) FROM pk_order GROUP BY toString(d) LIMIT 5;
|
||||
SELECT toStartOfHour(d) as d1, min(a), max(b) FROM pk_order GROUP BY d1 LIMIT 5;
|
||||
|
||||
DROP TABLE pk_order;
|
Loading…
Reference in New Issue
Block a user