ClickHouse/tests/queries/0_stateless/02177_issue_31009_pt2.sql.j2

41 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-03-15 18:51:04 +00:00
-- Tags: long
DROP TABLE IF EXISTS left;
DROP TABLE IF EXISTS right;
SET join_algorithm = 'partial_merge';
{% for block_size in [10, 11, 128, 129, 65505, 65506, 70000] -%}
{% for join_block_size in range(block_size - 2, block_size + 2) -%}
2022-03-20 14:50:45 +00:00
DROP TABLE IF EXISTS left;
DROP TABLE IF EXISTS right;
CREATE TABLE left ( key UInt32, value String ) ENGINE = Memory;
CREATE TABLE right ( key UInt32, value String ) ENGINE = Memory;
2022-03-15 18:51:04 +00:00
INSERT INTO left SELECT number, toString(number) FROM numbers({{ block_size * 2 + 1 }});
INSERT INTO right SELECT number, toString(number) FROM numbers({{ block_size * 2 + 5 }});
SET max_joined_block_size_rows = {{ join_block_size }};
SET max_block_size = {{ block_size }};
SELECT key, count(1) AS cnt
FROM (
SELECT *
FROM ( SELECT key FROM left AS s ) AS data
ALL LEFT JOIN ( SELECT key FROM right GROUP BY key ) AS promo ON promo.key = data.key
) GROUP BY key HAVING count(1) > 1
;
SELECT count() == (SELECT count() from left) AND min(key == promo.key) == 1
FROM ( SELECT key FROM left AS s ) AS data
ALL LEFT JOIN ( SELECT key FROM right GROUP BY key ) AS promo ON promo.key = data.key
;
{% endfor -%}
{% endfor -%}
DROP TABLE IF EXISTS left;
DROP TABLE IF EXISTS right;