Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c7e5bd3

Browse files
committed
Allow learning (and predicting for) on a ForeignScan, an Append, a MergeAppend, a SubqueryScan nodes.
Tags: shardman.
1 parent 776260d commit c7e5bd3

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

path_utils.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
7979
List *inner_sel = NIL;
8080
List *outer;
8181
List *outer_sel = NIL;
82-
List *cur;
82+
List *cur = NIL;
8383
List *cur_sel = NIL;
8484

8585
Assert(selectivities != NULL);
@@ -160,6 +160,32 @@ get_path_clauses(Path *path, PlannerInfo *root, List **selectivities)
160160
return get_path_clauses(((LimitPath *) path)->subpath, root,
161161
selectivities);
162162
break;
163+
case T_SubqueryScanPath:
164+
return get_path_clauses(((SubqueryScanPath *) path)->subpath, root,
165+
selectivities);
166+
break;
167+
case T_AppendPath:
168+
{
169+
ListCell *lc;
170+
171+
foreach (lc, ((AppendPath *) path)->subpaths)
172+
{
173+
Path *subpath = lfirst(lc);
174+
175+
cur = list_concat(cur, list_copy(
176+
get_path_clauses(subpath, root, selectivities)));
177+
cur_sel = list_concat(cur_sel, *selectivities);
178+
}
179+
cur = list_concat(cur, list_copy(path->parent->baserestrictinfo));
180+
*selectivities = list_concat(cur_sel,
181+
get_selectivities(root,
182+
path->parent->baserestrictinfo,
183+
0, JOIN_INNER, NULL));
184+
return cur;
185+
}
186+
break;
187+
case T_ForeignPath:
188+
/* The same as in the default case */
163189
default:
164190
cur = list_concat(list_copy(path->parent->baserestrictinfo),
165191
path->param_info ?

postprocessing.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ learnOnPlanState(PlanState *p, void *context)
252252
ctx->relidslist = list_copy(p->plan->path_relids);
253253

254254
if (p->instrument && (p->righttree != NULL || p->lefttree == NULL ||
255-
p->plan->path_clauses != NIL))
255+
p->plan->path_clauses != NIL ||
256+
IsA(p, ForeignScanState) ||
257+
IsA(p, AppendState) || IsA(p, MergeAppendState)))
256258
{
257259
double learn_rows = 0.;
258260
double predicted = 0.;

0 commit comments

Comments
 (0)