mirror of https://github.com/citusdata/citus.git
support multiple remote scans
parent
0d55755951
commit
aa3f283d02
|
@ -1755,7 +1755,29 @@ GetQueryFromPath(List *tlist, RangeTblEntry *rte)
|
||||||
Query *q = makeNode(Query);
|
Query *q = makeNode(Query);
|
||||||
q->commandType = CMD_SELECT;
|
q->commandType = CMD_SELECT;
|
||||||
q->rtable = list_make1(rte);
|
q->rtable = list_make1(rte);
|
||||||
q->targetList = tlist;
|
|
||||||
|
List *newTargetList = NIL;
|
||||||
|
TargetEntry *target = NULL;
|
||||||
|
foreach_ptr(target, tlist)
|
||||||
|
{
|
||||||
|
Var *var = castNode(Var, target->expr);
|
||||||
|
TargetEntry *newTarget = makeTargetEntry(
|
||||||
|
(Expr *) makeVar(
|
||||||
|
1,
|
||||||
|
var->varattno,
|
||||||
|
var->vartype,
|
||||||
|
var->vartypmod,
|
||||||
|
var->varcollid,
|
||||||
|
var->varlevelsup
|
||||||
|
),
|
||||||
|
target->resno,
|
||||||
|
target->resname,
|
||||||
|
target->resjunk
|
||||||
|
);
|
||||||
|
newTargetList = lappend(newTargetList, newTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
q->targetList = newTargetList;
|
||||||
q->jointree = makeNode(FromExpr);
|
q->jointree = makeNode(FromExpr);
|
||||||
RangeTblRef *rr = makeNode(RangeTblRef);
|
RangeTblRef *rr = makeNode(RangeTblRef);
|
||||||
rr->rtindex = 1;
|
rr->rtindex = 1;
|
||||||
|
@ -1764,6 +1786,15 @@ GetQueryFromPath(List *tlist, RangeTblEntry *rte)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static Index
|
||||||
|
VarnoFromFirstTargetEntry(List *tlist)
|
||||||
|
{
|
||||||
|
TargetEntry *entry = linitial_node(TargetEntry, tlist);
|
||||||
|
Var *var = castNode(Var, entry->expr);
|
||||||
|
return var->varno;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static Plan *
|
static Plan *
|
||||||
CreateDistributedUnionPlan(PlannerInfo *root,
|
CreateDistributedUnionPlan(PlannerInfo *root,
|
||||||
RelOptInfo *rel,
|
RelOptInfo *rel,
|
||||||
|
@ -1809,7 +1840,7 @@ CreateDistributedUnionPlan(PlannerInfo *root,
|
||||||
distributedPlan->hasReturning = true;
|
distributedPlan->hasReturning = true;
|
||||||
|
|
||||||
CustomScan *plan = makeNode(CustomScan);
|
CustomScan *plan = makeNode(CustomScan);
|
||||||
plan->scan.scanrelid = 1;
|
plan->scan.scanrelid = VarnoFromFirstTargetEntry(tlist);
|
||||||
plan->flags = best_path->flags;
|
plan->flags = best_path->flags;
|
||||||
plan->methods = &AdaptiveExecutorCustomScanMethods;
|
plan->methods = &AdaptiveExecutorCustomScanMethods;
|
||||||
plan->custom_private = list_make1(distributedPlan);
|
plan->custom_private = list_make1(distributedPlan);
|
||||||
|
|
Loading…
Reference in New Issue