Don't use repartitioned INSERT/SELECT for repartition joins

pull/3376/head
Hadi Moshayedi 2020-01-16 23:35:34 -08:00
parent 5eeb07124f
commit 6cf1c01660
3 changed files with 34 additions and 0 deletions

View File

@ -1057,6 +1057,12 @@ IsRedistributablePlan(Plan *selectPlan)
return false;
}
/* don't use redistribution for repartition joins for now */
if (distSelectJob->dependentJobList != NIL)
{
return false;
}
return true;
}

View File

@ -978,5 +978,21 @@ EXPLAIN (costs off) INSERT INTO target_table SELECT a AS aa, b AS aa, 1 AS aa, 2
(8 rows)
DROP TABLE source_table, target_table;
--
-- Don't use INSERT/SELECT repartition with repartition joins
--
create table test(x int, y int);
select create_distributed_table('test', 'x');
create_distributed_table
---------------------------------------------------------------------
(1 row)
set citus.enable_repartition_joins to true;
SET client_min_messages TO DEBUG1;
insert into test(y, x) select a.x, b.y from test a JOIN test b USING (y);
DEBUG: cannot perform distributed INSERT INTO ... SELECT because the partition columns in the source table and subquery do not match
DEBUG: Collecting INSERT ... SELECT results on coordinator
RESET client_min_messages;
SET client_min_messages TO WARNING;
DROP SCHEMA insert_select_repartition CASCADE;

View File

@ -452,5 +452,17 @@ EXPLAIN (costs off) INSERT INTO target_table SELECT a AS aa, b AS aa, 1 AS aa, 2
DROP TABLE source_table, target_table;
--
-- Don't use INSERT/SELECT repartition with repartition joins
--
create table test(x int, y int);
select create_distributed_table('test', 'x');
set citus.enable_repartition_joins to true;
SET client_min_messages TO DEBUG1;
insert into test(y, x) select a.x, b.y from test a JOIN test b USING (y);
RESET client_min_messages;
SET client_min_messages TO WARNING;
DROP SCHEMA insert_select_repartition CASCADE;