Skip to content

Commit

Permalink
some more
Browse files Browse the repository at this point in the history
  • Loading branch information
LordParag committed Jun 14, 2024
1 parent 16e4e15 commit ed23bb9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
22 changes: 16 additions & 6 deletions src/test/regress/expected/merge.out
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SELECT 1 FROM master_add_node('localhost', :master_port, groupid => 0);
1
(1 row)

ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 13000;
RESET client_min_messages;
CREATE TABLE source
(
Expand Down Expand Up @@ -1844,6 +1843,7 @@ SELECT compare_tables();

ROLLBACK;
-- let's create source and target table
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 13000;
CREATE TABLE source_pushdowntest (id integer);
CREATE TABLE target_pushdowntest (id integer );
-- let's distribute both table on id field
Expand All @@ -1861,12 +1861,22 @@ SELECT create_distributed_table('target_pushdowntest', 'id');

-- we are doing this operation on single node setup let's figure out colocation id of both tables
-- both has same colocation id so both are colocated.
select colocationid,logicalrelid from pg_dist_partition where logicalrelid = 'source_pushdowntest'::regclass OR logicalrelid = 'target_pushdowntest'::regclass;
colocationid | logicalrelid
WITH colocations AS (
SELECT colocationid
FROM pg_dist_partition
WHERE logicalrelid = 'source_pushdowntest'::regclass
OR logicalrelid = 'target_pushdowntest'::regclass
)
SELECT
CASE
WHEN COUNT(DISTINCT colocationid) = 1 THEN 'Same'
ELSE 'Different'
END AS colocation_status
FROM colocations;
colocation_status
---------------------------------------------------------------------
13000 | source_pushdowntest
13000 | target_pushdowntest
(2 rows)
Same
(1 row)

SET client_min_messages TO DEBUG1;
-- Test 1 : tables are colocated AND query is multisharded AND Join On distributed column : should push down to workers.
Expand Down
16 changes: 14 additions & 2 deletions src/test/regress/sql/merge.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ SET citus.shard_replication_factor TO 1;
SET citus.max_adaptive_executor_pool_size TO 1;
SET client_min_messages = warning;
SELECT 1 FROM master_add_node('localhost', :master_port, groupid => 0);
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 13000;
RESET client_min_messages;

CREATE TABLE source
Expand Down Expand Up @@ -1209,6 +1208,7 @@ ROLLBACK;


-- let's create source and target table
ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 13000;
CREATE TABLE source_pushdowntest (id integer);
CREATE TABLE target_pushdowntest (id integer );

Expand All @@ -1218,7 +1218,19 @@ SELECT create_distributed_table('target_pushdowntest', 'id');

-- we are doing this operation on single node setup let's figure out colocation id of both tables
-- both has same colocation id so both are colocated.
select colocationid,logicalrelid from pg_dist_partition where logicalrelid = 'source_pushdowntest'::regclass OR logicalrelid = 'target_pushdowntest'::regclass;
WITH colocations AS (
SELECT colocationid
FROM pg_dist_partition
WHERE logicalrelid = 'source_pushdowntest'::regclass
OR logicalrelid = 'target_pushdowntest'::regclass
)
SELECT
CASE
WHEN COUNT(DISTINCT colocationid) = 1 THEN 'Same'
ELSE 'Different'
END AS colocation_status
FROM colocations;


SET client_min_messages TO DEBUG1;
-- Test 1 : tables are colocated AND query is multisharded AND Join On distributed column : should push down to workers.
Expand Down

0 comments on commit ed23bb9

Please sign in to comment.