Skip to content

Commit 1a27df7

Browse files
committed
move extraction of joinclauses\otherclauses outside of the create_pickyappend_path()
1 parent 1446379 commit 1a27df7

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

pickyappend.c

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,9 @@ static Path *
181181
create_pickyappend_path(PlannerInfo *root,
182182
AppendPath *inner_append,
183183
ParamPathInfo *param_info,
184-
JoinPathExtraData *extra)
184+
List *picky_clauses)
185185
{
186186
RelOptInfo *innerrel = inner_append->path.parent;
187-
List *joinrestrictclauses = extra->restrictlist;
188-
List *joinclauses;
189-
List *otherclauses;
190187
ListCell *lc;
191188
int i;
192189

@@ -197,18 +194,6 @@ create_pickyappend_path(PlannerInfo *root,
197194
result = palloc0(sizeof(PickyAppendPath));
198195
NodeSetTag(result, T_CustomPath);
199196

200-
if (IS_OUTER_JOIN(extra->sjinfo->jointype))
201-
{
202-
extract_actual_join_clauses(joinrestrictclauses,
203-
&joinclauses, &otherclauses);
204-
}
205-
else
206-
{
207-
/* We can treat all clauses alike for an inner join */
208-
joinclauses = extract_actual_clauses(joinrestrictclauses, false);
209-
otherclauses = NIL;
210-
}
211-
212197
result->cpath.path.pathtype = T_CustomScan;
213198
result->cpath.path.parent = innerrel;
214199
result->cpath.path.param_info = param_info;
@@ -225,7 +210,7 @@ create_pickyappend_path(PlannerInfo *root,
225210
result->cpath.path.total_cost = 0;
226211

227212
/* Set 'partitioned column'-related clauses */
228-
result->cpath.custom_private = joinclauses;
213+
result->cpath.custom_private = picky_clauses;
229214
result->cpath.custom_paths = NIL;
230215

231216
Assert(inner_entry->relid != 0);
@@ -270,6 +255,9 @@ pathman_join_pathlist_hook(PlannerInfo *root,
270255
PartRelationInfo *inner_prel;
271256
NestPath *nest_path;
272257
List *pathkeys = NIL;
258+
List *joinrestrictclauses = extra->restrictlist;
259+
List *joinclauses,
260+
*otherclauses;
273261
ListCell *lc;
274262

275263
if (set_join_pathlist_next)
@@ -286,6 +274,19 @@ pathman_join_pathlist_hook(PlannerInfo *root,
286274
return; /* Obviously not our case */
287275
}
288276

277+
/* Extract join clauses which will separate partitions */
278+
if (IS_OUTER_JOIN(extra->sjinfo->jointype))
279+
{
280+
extract_actual_join_clauses(joinrestrictclauses,
281+
&joinclauses, &otherclauses);
282+
}
283+
else
284+
{
285+
/* We can treat all clauses alike for an inner join */
286+
joinclauses = extract_actual_clauses(joinrestrictclauses, false);
287+
otherclauses = NIL;
288+
}
289+
289290
foreach (lc, innerrel->pathlist)
290291
{
291292
AppendPath *cur_inner_path = (AppendPath *) lfirst(lc);
@@ -301,19 +302,19 @@ pathman_join_pathlist_hook(PlannerInfo *root,
301302
inner = create_pickyappend_path(root, cur_inner_path,
302303
get_appendrel_parampathinfo(innerrel,
303304
inner_required),
304-
extra);
305+
joinclauses);
305306

306307
initial_cost_nestloop(root, &workspace, jointype,
307-
outer, inner,
308-
extra->sjinfo, &extra->semifactors);
308+
outer, inner,
309+
extra->sjinfo, &extra->semifactors);
309310

310311
pathkeys = build_join_pathkeys(root, joinrel, jointype, outer->pathkeys);
311312

312313
nest_path = create_nestloop_path(root, joinrel, jointype, &workspace,
313-
extra->sjinfo, &extra->semifactors,
314-
outer, inner, extra->restrictlist,
315-
pathkeys,
316-
calc_nestloop_required_outer(outer, inner));
314+
extra->sjinfo, &extra->semifactors,
315+
outer, inner, extra->restrictlist,
316+
pathkeys,
317+
calc_nestloop_required_outer(outer, inner));
317318

318319
add_path(joinrel, (Path *) nest_path);
319320
}

0 commit comments

Comments
 (0)