Add new regression tests

pull/6512/head
Onur Tirtir 2022-11-29 13:50:06 +03:00
parent 2803470b58
commit b177975371
6 changed files with 3248 additions and 1 deletions

View File

@ -0,0 +1,119 @@
SET search_path TO local_dist_join_mixed;
SELECT COUNT(*) FROM reference LEFT JOIN distributed USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM distributed RIGHT JOIN reference USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM reference FULL JOIN distributed USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM distributed FULL JOIN reference USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM distributed FULL JOIN reference USING (id);
count
---------------------------------------------------------------------
101
(1 row)
-- distributed side is a subquery
SELECT COUNT(*) FROM reference LEFT JOIN (SELECT * FROM distributed) q USING (id);
count
---------------------------------------------------------------------
101
(1 row)
-- distributed side is a join tree
SELECT COUNT(*) FROM reference LEFT JOIN (distributed t1 JOIN distributed t2 USING (id)) q USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM reference LEFT JOIN (distributed t1 LEFT JOIN distributed t2 USING (id)) q USING (id);
count
---------------------------------------------------------------------
101
(1 row)
SELECT COUNT(*) FROM
-- 2) right side is distributed but t1 is recurring, hence what
-- makes the right side distributed (t4) is recursively planned
reference t1
LEFT JOIN
(
distributed t4
JOIN
-- 1) t6 is recursively planned since the outer side is recurring
(SELECT t6.id FROM distributed t6 RIGHT JOIN reference t7 USING(id)) t5
USING(id)
) q
USING(id)
-- 3) outer side of the join tree became recurring, hence t8 is
-- recursively planned too
LEFT JOIN
distributed t8
USING (id)
WHERE t8.id IS NULL;
count
---------------------------------------------------------------------
0
(1 row)
SELECT COUNT(*) FROM
local t1
LEFT JOIN
-- 2) t6 subquery is distributed so needs to be recursively planned
-- because t1 is first recursively planned
(
SELECT * FROM
(SELECT * FROM reference t2 JOIN distributed t3 USING (id)) p
JOIN
-- 1) t5 is recursively planned since the outer side is recurring
(SELECT * FROM reference t4 LEFT JOIN distributed t5 USING (id)) q
USING(id)
) t6
USING (id);
count
---------------------------------------------------------------------
101
(1 row)
BEGIN;
WITH cte AS (
DELETE FROM distributed
USING (
SELECT t1.id, t1.id*3 FROM reference t1
LEFT JOIN
(
SELECT * FROM distributed t2 WHERE EXISTS (
SELECT * FROM distributed t4
WHERE t4.id = t2.id
)
) t3
USING (id)
) q
WHERE distributed.id = q.id AND
distributed.id > 65
RETURNING *
)
SELECT COUNT(*) FROM cte;
count
---------------------------------------------------------------------
35
(1 row)
ROLLBACK;

File diff suppressed because it is too large Load Diff

View File

@ -198,6 +198,7 @@ test: local_dist_join_modifications
test: local_table_join test: local_table_join
test: local_dist_join_mixed test: local_dist_join_mixed
test: citus_local_dist_joins test: citus_local_dist_joins
test: recurring_outer_join
test: pg_dump test: pg_dump
# --------- # ---------

View File

@ -0,0 +1,74 @@
SET search_path TO local_dist_join_mixed;
SELECT COUNT(*) FROM reference LEFT JOIN distributed USING (id);
SELECT COUNT(*) FROM distributed RIGHT JOIN reference USING (id);
SELECT COUNT(*) FROM reference FULL JOIN distributed USING (id);
SELECT COUNT(*) FROM distributed FULL JOIN reference USING (id);
SELECT COUNT(*) FROM distributed FULL JOIN reference USING (id);
-- distributed side is a subquery
SELECT COUNT(*) FROM reference LEFT JOIN (SELECT * FROM distributed) q USING (id);
-- distributed side is a join tree
SELECT COUNT(*) FROM reference LEFT JOIN (distributed t1 JOIN distributed t2 USING (id)) q USING (id);
SELECT COUNT(*) FROM reference LEFT JOIN (distributed t1 LEFT JOIN distributed t2 USING (id)) q USING (id);
SELECT COUNT(*) FROM
-- 2) right side is distributed but t1 is recurring, hence what
-- makes the right side distributed (t4) is recursively planned
reference t1
LEFT JOIN
(
distributed t4
JOIN
-- 1) t6 is recursively planned since the outer side is recurring
(SELECT t6.id FROM distributed t6 RIGHT JOIN reference t7 USING(id)) t5
USING(id)
) q
USING(id)
-- 3) outer side of the join tree became recurring, hence t8 is
-- recursively planned too
LEFT JOIN
distributed t8
USING (id)
WHERE t8.id IS NULL;
SELECT COUNT(*) FROM
local t1
LEFT JOIN
-- 2) t6 subquery is distributed so needs to be recursively planned
-- because t1 is first recursively planned
(
SELECT * FROM
(SELECT * FROM reference t2 JOIN distributed t3 USING (id)) p
JOIN
-- 1) t5 is recursively planned since the outer side is recurring
(SELECT * FROM reference t4 LEFT JOIN distributed t5 USING (id)) q
USING(id)
) t6
USING (id);
BEGIN;
WITH cte AS (
DELETE FROM distributed
USING (
SELECT t1.id, t1.id*3 FROM reference t1
LEFT JOIN
(
SELECT * FROM distributed t2 WHERE EXISTS (
SELECT * FROM distributed t4
WHERE t4.id = t2.id
)
) t3
USING (id)
) q
WHERE distributed.id = q.id AND
distributed.id > 65
RETURNING *
)
SELECT COUNT(*) FROM cte;
ROLLBACK;

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ test: ch_benchmarks_1 ch_benchmarks_2 ch_benchmarks_3
test: ch_benchmarks_4 ch_benchmarks_5 ch_benchmarks_6 test: ch_benchmarks_4 ch_benchmarks_5 ch_benchmarks_6
test: intermediate_result_pruning_queries_1 intermediate_result_pruning_queries_2 test: intermediate_result_pruning_queries_1 intermediate_result_pruning_queries_2
test: dropped_columns_1 distributed_planning test: dropped_columns_1 distributed_planning
test: local_dist_join nested_execution test: local_dist_join nested_execution arbitrary_configs_recurring_outer_join
test: connectivity_checks citus_run_command test: connectivity_checks citus_run_command
test: schemas test: schemas
test: views test: views