add test for aggregation by primary key and many parts

This commit is contained in:
Anton Popov 2021-04-02 00:32:09 +03:00
parent 88cd775f6a
commit 6aecaea664
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,11 @@
94950
84950
74950
64950
54950
=======
94950
84950
74950
64950
54950

View File

@ -0,0 +1,16 @@
DROP TABLE IF EXISTS group_by_pk;
CREATE TABLE group_by_pk (k UInt64, v UInt64)
ENGINE = MergeTree ORDER BY k PARTITION BY v % 50;
INSERT INTO group_by_pk SELECT number / 100, number FROM numbers(1000);
SELECT sum(v) AS s FROM group_by_pk GROUP BY k ORDER BY s DESC LIMIT 5
SETTINGS optimize_aggregation_in_order = 1, max_block_size = 1;
SELECT '=======';
SELECT sum(v) AS s FROM group_by_pk GROUP BY k ORDER BY s DESC LIMIT 5
SETTINGS optimize_aggregation_in_order = 0, max_block_size = 1;
DROP TABLE IF EXISTS group_by_pk;