Skip to content

Commit

Permalink
Remove changing volatile to singleqe
Browse files Browse the repository at this point in the history
  • Loading branch information
red1452 committed Dec 27, 2024
1 parent 4b791e6 commit ee3cab1
Show file tree
Hide file tree
Showing 5 changed files with 545 additions and 78 deletions.
43 changes: 0 additions & 43 deletions src/backend/optimizer/path/allpaths.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ static void remove_unused_subquery_outputs(Query *subquery, RelOptInfo *rel);
static void bring_to_outer_query(PlannerInfo *root, RelOptInfo *rel, List *outer_quals);
static void bring_to_singleQE(PlannerInfo *root, RelOptInfo *rel);
static bool is_query_contain_limit_groupby(Query *parse);
static void handle_gen_seggen_volatile_path(PlannerInfo *root, RelOptInfo *rel);


/*
Expand Down Expand Up @@ -645,40 +644,6 @@ bring_to_singleQE(PlannerInfo *root, RelOptInfo *rel)
set_cheapest(rel);
}

/*
* handle_gen_seggen_volatile_path
*
* Only use for base replicated rel.
* Change the path in its pathlist if match the pattern
* (segmentgeneral or general path contains volatile restrictions).
*/
static void
handle_gen_seggen_volatile_path(PlannerInfo *root, RelOptInfo *rel)
{
List *origpathlist;
ListCell *lc;

origpathlist = rel->pathlist;
rel->cheapest_startup_path = NULL;
rel->cheapest_total_path = NULL;
rel->cheapest_unique_path = NULL;
rel->cheapest_parameterized_paths = NIL;
rel->pathlist = NIL;

foreach(lc, origpathlist)
{
Path *origpath = (Path *) lfirst(lc);
Path *path;

path = turn_volatile_seggen_to_singleqe(root,
origpath,
(Node *) (rel->baserestrictinfo));
add_path(rel, path);
}

set_cheapest(rel);
}

/*
* set_rel_pathlist
* Build access paths for a base relation
Expand Down Expand Up @@ -750,14 +715,6 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
}
}

/*
* Greenplum specific behavior:
* Change the path in pathlist if it is a general or segmentgeneral
* path that contains volatile restrictions.
*/
if (rel->reloptkind == RELOPT_BASEREL)
handle_gen_seggen_volatile_path(root, rel);

/*
* Allow a plugin to editorialize on the set of Paths for this base
* relation. It could add new paths (such as CustomPaths) by calling
Expand Down
7 changes: 3 additions & 4 deletions src/test/regress/expected/bfv_planner.out
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,12 @@ where x.a > random();
----------------------------------------------------------------
Gather Motion 3:1 (slice1; segments: 3)
-> Nested Loop
-> Broadcast Motion 1:3 (slice2; segments: 1)
-> Function Scan on generate_series a
Filter: ((a)::double precision > random())
-> Function Scan on generate_series a
Filter: ((a)::double precision > random())
-> Materialize
-> Seq Scan on t_hashdist
Optimizer: Postgres query optimizer
(8 rows)
(7 rows)

---- join qual
explain (costs off) select * from
Expand Down
Loading

0 comments on commit ee3cab1

Please sign in to comment.