ClickHouse/tests/queries/0_stateless/03143_asof_join_ddb_long.sql

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

52 lines
1.2 KiB
MySQL
Raw Normal View History

2023-09-28 12:52:20 +00:00
-- Tags: long
DROP TABLE IF EXISTS build;
DROP TABLE IF EXISTS skewed_probe;
SET session_timezone = 'UTC';
2023-09-28 12:52:20 +00:00
CREATE TABLE build ENGINE = MergeTree ORDER BY (key, begin)
AS
SELECT
toDateTime('1990-03-21 13:00:00') + INTERVAL number MINUTE AS begin,
number % 4 AS key,
number AS value
2024-07-25 17:35:21 +00:00
FROM numbers(0, 4000000);
2023-09-28 12:52:20 +00:00
CREATE TABLE skewed_probe ENGINE = MergeTree ORDER BY (key, begin)
AS
SELECT
toDateTime('1990-04-21 13:00:01') + INTERVAL number MINUTE AS begin,
0 AS key
FROM numbers(0, 5)
UNION ALL
SELECT
toDateTime('1990-05-21 13:00:01') + INTERVAL number MINUTE AS begin,
1 AS key
FROM numbers(0, 10)
UNION ALL
SELECT
toDateTime('1990-06-21 13:00:01') + INTERVAL number MINUTE AS begin,
2 AS key
FROM numbers(0, 20)
UNION ALL
SELECT
toDateTime('1990-03-21 13:00:01') + INTERVAL number MINUTE AS begin,
3 AS key
2024-07-25 17:35:21 +00:00
FROM numbers(0, 4000000);
2023-09-28 12:52:20 +00:00
2024-07-25 20:08:32 +00:00
SET max_rows_to_read = 0;
2023-09-28 12:52:20 +00:00
SELECT SUM(value), COUNT(*)
FROM skewed_probe
ASOF JOIN build
USING (key, begin)
;
SELECT SUM(value), COUNT(*)
FROM skewed_probe
ASOF JOIN build
USING (key, begin)
SETTINGS join_algorithm = 'full_sorting_merge'
;