Restore Test Coverage for Pushing Down Subqueries. (#6976)

When we add the coordinator in metadata, reference tables gets
replicated to coordinator. As a result we lose some test coverage since
some queries start to run locally instead of getting pushed down.

This PR adds new test cases involving distributed tables instead of
reference tables for covering distributed execution in related cases.
pull/6974/head
Emel Şimşek 2023-06-07 12:14:34 +03:00 committed by GitHub
parent 8d8968ae63
commit 6369645db4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

View File

@ -590,6 +590,30 @@ $Q$);
Task Count: 1
(2 rows)
CREATE TABLE dist_table(text_col text, int_col int);
SELECT create_distributed_table('dist_table', 'text_col');
create_distributed_table
---------------------------------------------------------------------
(1 row)
SELECT public.coordinator_plan_with_subplans($Q$
EXPLAIN (COSTS OFF) WITH cte AS (
SELECT application_name AS text_col
FROM pg_stat_activity
) SELECT * FROM dist_table JOIN cte USING (text_col);
$Q$);
coordinator_plan_with_subplans
---------------------------------------------------------------------
Custom Scan (Citus Adaptive)
-> Distributed Subplan XXX_1
-> Function Scan on pg_stat_get_activity s
-> Distributed Subplan XXX_2
-> Custom Scan (Citus Adaptive)
Task Count: 1
Task Count: 4
(7 rows)
CREATE OR REPLACE VIEW view_on_views AS SELECT pg_stat_activity.application_name, pg_locks.pid FROM pg_stat_activity, pg_locks;
SELECT public.coordinator_plan_with_subplans($Q$
EXPLAIN (COSTS OFF) WITH cte AS (
@ -603,6 +627,22 @@ $Q$);
Task Count: 1
(2 rows)
SELECT public.coordinator_plan_with_subplans($Q$
EXPLAIN (COSTS OFF) WITH cte AS (
SELECT application_name AS text_col
FROM view_on_views
) SELECT * FROM dist_table JOIN cte USING (text_col);
$Q$);
coordinator_plan_with_subplans
---------------------------------------------------------------------
Custom Scan (Citus Adaptive)
-> Distributed Subplan XXX_1
-> Nested Loop
-> Function Scan on pg_stat_get_activity s
-> Function Scan on pg_lock_status l
Task Count: 4
(6 rows)
SET client_min_messages TO WARNING;
DROP SCHEMA subquery_view CASCADE;
SET search_path TO public;

View File

@ -434,6 +434,17 @@ EXPLAIN (COSTS OFF) WITH cte AS (
) SELECT * FROM reference_table JOIN cte USING (text_col);
$Q$);
CREATE TABLE dist_table(text_col text, int_col int);
SELECT create_distributed_table('dist_table', 'text_col');
SELECT public.coordinator_plan_with_subplans($Q$
EXPLAIN (COSTS OFF) WITH cte AS (
SELECT application_name AS text_col
FROM pg_stat_activity
) SELECT * FROM dist_table JOIN cte USING (text_col);
$Q$);
CREATE OR REPLACE VIEW view_on_views AS SELECT pg_stat_activity.application_name, pg_locks.pid FROM pg_stat_activity, pg_locks;
SELECT public.coordinator_plan_with_subplans($Q$
@ -443,6 +454,13 @@ EXPLAIN (COSTS OFF) WITH cte AS (
) SELECT * FROM reference_table JOIN cte USING (text_col);
$Q$);
SELECT public.coordinator_plan_with_subplans($Q$
EXPLAIN (COSTS OFF) WITH cte AS (
SELECT application_name AS text_col
FROM view_on_views
) SELECT * FROM dist_table JOIN cte USING (text_col);
$Q$);
SET client_min_messages TO WARNING;
DROP SCHEMA subquery_view CASCADE;
SET search_path TO public;