ClickHouse/tests/queries/0_stateless/00981_topK_topKWeighted_long.sql

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
537 B
MySQL
Raw Normal View History

2021-09-12 12:35:27 +00:00
-- Tags: long
DROP TABLE IF EXISTS topk;
2023-08-12 17:31:18 +00:00
CREATE TABLE topk (val1 String, val2 UInt32) ENGINE = MergeTree ORDER BY val1 SETTINGS index_granularity = 8192, index_granularity_bytes = '10Mi';
2020-08-15 17:55:49 +00:00
INSERT INTO topk WITH number % 7 = 0 AS frequent SELECT toString(frequent ? number % 10 : number), frequent ? 999999999 : number FROM numbers(4000000);
SELECT arraySort(topK(10)(val1)) FROM topk;
SELECT arraySort(topKWeighted(10)(val1, val2)) FROM topk;
SELECT topKWeighted(10)(toString(number), number) from numbers(3000000);
DROP TABLE topk;