Skip to content

Commit

Permalink
Fix Merge GPDB.
Browse files Browse the repository at this point in the history
Some codes do not work in CBDB after Merge from GPDB.
Fix errors and etc.

Authored-by: Zhang Mingli avamingli@gmail.com
  • Loading branch information
avamingli authored and my-ship-it committed May 14, 2024
1 parent e0a72ff commit 30da5b4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/backend/optimizer/util/pathnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -3648,9 +3648,9 @@ create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
case FTEXECLOCATION_ALL_SEGMENTS:
server = GetForeignServer(rel->serverid);
if (server)
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), server->num_segments);
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), server->num_segments, 0);
else
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount());
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount(), 0);
break;
case FTEXECLOCATION_COORDINATOR:
CdbPathLocus_MakeEntry(&(pathnode->path.locus));
Expand Down Expand Up @@ -3718,9 +3718,9 @@ create_foreign_join_path(PlannerInfo *root, RelOptInfo *rel,
case FTEXECLOCATION_ALL_SEGMENTS:
server = GetForeignServer(rel->serverid);
if (server)
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), server->num_segments);
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), server->num_segments, 0);
else
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount());
CdbPathLocus_MakeStrewn(&(pathnode->path.locus), getgpsegmentCount(), 0);
break;
case FTEXECLOCATION_COORDINATOR:
CdbPathLocus_MakeEntry(&(pathnode->path.locus));
Expand Down
2 changes: 2 additions & 0 deletions src/test/regress/expected/aggregates_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,8 @@ INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
NOTICE: avg_transfn called with 1
NOTICE: avg_transfn called with 3
NOTICE: avg_transfn called with 3
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: GPDB Expression type: Query Parameter not supported in DXL
Expand Down
16 changes: 16 additions & 0 deletions src/test/regress/expected/gp_dqa_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -2338,12 +2338,16 @@ insert into dqa_f3 values ('123', 2), ('213', 0), ('231', 2), ('312', 0), ('321'
-- -> Seq Scan on public.dqa_f3
-- Output: b, a, (b)::text
select count(distinct (b)::text) as b, count(distinct (a)::text) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
b | a
---+---
3 | 7
(1 row)

explain (verbose, costs off) select count(distinct (b)::text) as b, count(distinct (a)::text) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
------------------------------------------------------------------------------------------------
Finalize Aggregate
Expand All @@ -2369,12 +2373,16 @@ explain (verbose, costs off) select count(distinct (b)::text) as b, count(distin

-- Case 2: Same as the above one, but convert the type of column 'a' to 'varchar' via binary-compatible types.
select count(distinct (b)::text) as b, count(distinct (a)::text::varchar) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
b | a
---+---
3 | 7
(1 row)

explain (verbose, costs off) select count(distinct (b)::text) as b, count(distinct (a)::text::varchar) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
-------------------------------------------------------------------------------------------------------------
Finalize Aggregate
Expand Down Expand Up @@ -2410,12 +2418,16 @@ explain (verbose, costs off) select count(distinct (b)::text) as b, count(distin
-- -> Seq Scan on public.dqa_f3
-- Output: b, a, (b)::text, (a)::integer
select count(distinct (b)::text) as b, count(distinct (a)::int) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
b | a
---+---
3 | 7
(1 row)

explain (verbose, costs off) select count(distinct (b)::text) as b, count(distinct (a)::int) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
---------------------------------------------------------------------------------------------------
Finalize Aggregate
Expand All @@ -2442,12 +2454,16 @@ explain (verbose, costs off) select count(distinct (b)::text) as b, count(distin
-- Case 4: When converting the type of column 'a' from 'varchar' to 'int' to 'varchar', TupleSplit should generate an additional
-- column '(a)::integer::varchar' as part of hash-key in Redistribute-Motion.
select count(distinct (b)::text) as b, count(distinct (a)::int::varchar) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
b | a
---+---
3 | 7
(1 row)

explain (verbose, costs off) select count(distinct (b)::text) as b, count(distinct (a)::int::varchar) as a from dqa_f3;
INFO: GPORCA failed to produce a plan, falling back to planner
DETAIL: Feature not supported: Multiple Distinct Qualified Aggregates are disabled in the optimizer
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Finalize Aggregate
Expand Down
6 changes: 6 additions & 0 deletions src/test/regress/sql/gp_foreign_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER dummy OPTIONS (num_segments '5');

-- CHECK FOREIGN SERVER's OPTIONS
SELECT srvoptions FROM pg_foreign_server WHERE srvname = 's1';

-- start_ignore
DROP SERVER s0 CASCADE;
DROP SERVER s1 CASCADE;
DROP FOREIGN DATA WRAPPER dummy CASCADE;
-- end_ignore

0 comments on commit 30da5b4

Please sign in to comment.