Skip to content

Commit

Permalink
Fix test cases of cherry-pick.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjhjstz committed Dec 31, 2024
1 parent 7a5566b commit 764700f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 35 deletions.
21 changes: 12 additions & 9 deletions src/test/regress/expected/rpt_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -1092,17 +1092,20 @@ set optimizer_enable_hashjoin=off;
set enable_hashjoin=off;
set enable_nestloop=on;
explain select b from dist_tab where b in (select distinct c from rep_tab);
QUERY PLAN
------------------------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (cost=10000000001.15..10000000021.42 rows=4 width=4)
-> Nested Loop (cost=10000000001.15..10000000021.36 rows=1 width=4)
-> HashAggregate (cost=10000000001.02..10000000001.03 rows=2 width=4)
QUERY PLAN
---------------------------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..443.00 rows=4 width=4)
-> Nested Loop (cost=0.00..443.00 rows=2 width=4)
Join Filter: true
-> GroupAggregate (cost=0.00..431.00 rows=2 width=4)
Group Key: rep_tab.c
-> Seq Scan on rep_tab (cost=10000000000.00..10000000001.02 rows=2 width=4)
-> Index Only Scan using idx on dist_tab (cost=0.13..10.16 rows=1 width=4)
-> Sort (cost=0.00..431.00 rows=2 width=4)
Sort Key: rep_tab.c
-> Seq Scan on rep_tab (cost=0.00..431.00 rows=2 width=4)
-> Index Scan using idx on dist_tab (cost=0.00..12.00 rows=1 width=4)
Index Cond: (b = rep_tab.c)
Optimizer: Postgres query optimizer
(8 rows)
Optimizer: Pivotal Optimizer (GPORCA)
(11 rows)

select b from dist_tab where b in (select distinct c from rep_tab);
b
Expand Down
57 changes: 31 additions & 26 deletions src/test/regress/expected/subselect_gp_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -1775,22 +1775,27 @@ EXPLAIN select count(distinct ss.ten) from
EXPLAIN select count(*) from
(select 1 from tenk1 a
where unique1 IN (select distinct hundred from tenk1 b)) ss;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------
Finalize Aggregate (cost=210.51..210.52 rows=1 width=8)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=210.45..210.50 rows=3 width=8)
-> Partial Aggregate (cost=210.45..210.46 rows=1 width=8)
-> Hash Join (cost=138.92..210.37 rows=33 width=0)
Hash Cond: (a.unique1 = b.hundred)
-> Seq Scan on tenk1 a (cost=0.00..62.33 rows=3333 width=4)
-> Hash (cost=137.67..137.67 rows=100 width=4)
-> HashAggregate (cost=137.33..137.67 rows=100 width=4)
Group Key: b.hundred
-> Redistribute Motion 3:3 (slice2; segments: 3) (cost=0.00..129.00 rows=3333 width=4)
Hash Key: b.hundred
-> Seq Scan on tenk1 b (cost=0.00..62.33 rows=3333 width=4)
Optimizer: Postgres query optimizer
(13 rows)
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------
Finalize Aggregate (cost=0.00..431.99 rows=1 width=8)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..431.99 rows=1 width=8)
-> Partial Aggregate (cost=0.00..431.99 rows=1 width=8)
-> Nested Loop (cost=0.00..431.99 rows=34 width=1)
Join Filter: true
-> Broadcast Motion 3:3 (slice2; segments: 3) (cost=0.00..431.95 rows=100 width=4)
-> GroupAggregate (cost=0.00..431.94 rows=34 width=4)
Group Key: tenk1.hundred
-> Sort (cost=0.00..431.94 rows=34 width=4)
Sort Key: tenk1.hundred
-> Redistribute Motion 3:3 (slice3; segments: 3) (cost=0.00..431.94 rows=34 width=4)
Hash Key: tenk1.hundred
-> Streaming HashAggregate (cost=0.00..431.94 rows=34 width=4)
Group Key: tenk1.hundred
-> Seq Scan on tenk1 (cost=0.00..431.51 rows=3334 width=4)
-> Index Only Scan using tenk1_unique1 on tenk1 tenk1_1 (cost=0.00..0.04 rows=1 width=1)
Index Cond: (unique1 = tenk1.hundred)
Optimizer: Pivotal Optimizer (GPORCA)
(18 rows)

EXPLAIN select count(distinct ss.ten) from
(select ten from tenk1 a
Expand All @@ -1815,7 +1820,7 @@ EXPLAIN select count(distinct ss.ten) from
-> Streaming HashAggregate (cost=0.00..431.94 rows=34 width=4)
Group Key: tenk1_1.hundred
-> Seq Scan on tenk1 tenk1_1 (cost=0.00..431.51 rows=3334 width=4)
Optimizer: Pivotal Optimizer (GPORCA) version 3.64.0
Optimizer: Pivotal Optimizer (GPORCA)
(19 rows)

--
Expand All @@ -1827,18 +1832,18 @@ EXPLAIN select count(distinct ss.ten) from
EXPLAIN SELECT EXISTS(SELECT * FROM tenk1 WHERE tenk1.unique1 = tenk2.unique1) FROM tenk2 LIMIT 1;
QUERY PLAN
----------------------------------------------------------------------------------------------
Limit (cost=0.00..865.43 rows=1 width=1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..865.43 rows=1 width=1)
-> Limit (cost=0.00..865.43 rows=1 width=1)
-> Hash Left Join (cost=0.00..865.40 rows=3334 width=8)
Limit (cost=0.00..865.45 rows=1 width=1)
-> Gather Motion 3:1 (slice1; segments: 3) (cost=0.00..865.45 rows=1 width=1)
-> Limit (cost=0.00..865.45 rows=1 width=1)
-> Hash Left Join (cost=0.00..865.42 rows=3334 width=8)
Hash Cond: (tenk2.unique1 = tenk1.unique1)
-> Seq Scan on tenk2 (cost=0.00..431.50 rows=3334 width=4)
-> Hash (cost=431.95..431.95 rows=3334 width=12)
-> HashAggregate (cost=0.00..431.95 rows=3334 width=12)
-> Seq Scan on tenk2 (cost=0.00..431.51 rows=3334 width=4)
-> Hash (cost=431.96..431.96 rows=3334 width=12)
-> HashAggregate (cost=0.00..431.96 rows=3334 width=12)
Group Key: tenk1.unique1
-> Seq Scan on tenk1 (cost=0.00..431.50 rows=3334 width=4)
-> Seq Scan on tenk1 (cost=0.00..431.51 rows=3334 width=4)
Optimizer: Pivotal Optimizer (GPORCA)
(19 rows)
(11 rows)

SELECT EXISTS(SELECT * FROM tenk1 WHERE tenk1.unique1 = tenk2.unique1) FROM tenk2 LIMIT 1;
exists
Expand Down

0 comments on commit 764700f

Please sign in to comment.