ClickHouse/tests/queries/0_stateless/01031_new_any_join.sql.j2

40 lines
1.1 KiB
Plaintext
Raw Normal View History

DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 (x UInt32, s String) engine = Memory;
CREATE TABLE t2 (x UInt32, s String) engine = Memory;
INSERT INTO t1 (x, s) VALUES (0, 'a1'), (1, 'a2'), (2, 'a3'), (3, 'a4'), (4, 'a5');
2022-02-06 13:31:59 +00:00
INSERT INTO t2 (x, s) VALUES (2, 'b1'), (4, 'b3'), (5, 'b6');
SET join_use_nulls = 0;
SET any_join_distinct_right_table_keys = 0;
2022-04-06 14:40:17 +00:00
{% for join_algorithm in ['hash', 'full_sorting_merge'] -%}
SET join_algorithm = '{{ join_algorithm }}';
SELECT 'join_algorithm: {{ join_algorithm }}';
2022-04-05 10:12:42 +00:00
SELECT 'any left';
SELECT t1.*, t2.* FROM t1 ANY LEFT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
SELECT 'any left (rev)';
SELECT t1.*, t2.* FROM t2 ANY LEFT JOIN t1 USING(x) ORDER BY t1.x, t2.x;
SELECT 'any inner';
SELECT t1.*, t2.* FROM t1 ANY INNER JOIN t2 USING(x) ORDER BY t1.x, t2.x;
SELECT 'any inner (rev)';
SELECT t1.*, t2.* FROM t2 ANY INNER JOIN t1 USING(x) ORDER BY t1.x, t2.x;
SELECT 'any right';
SELECT t1.*, t2.* FROM t1 ANY RIGHT JOIN t2 USING(x) ORDER BY t1.x, t2.x;
SELECT 'any right (rev)';
SELECT t1.*, t2.* FROM t2 ANY RIGHT JOIN t1 USING(x) ORDER BY t1.x, t2.x;
2022-04-06 14:40:17 +00:00
{% endfor -%}
DROP TABLE t1;
DROP TABLE t2;