mirror of https://github.com/citusdata/citus.git
Centralize more of distributed planning into CreateDistributedPlan().
The name CreatePhysicalPlan() hasn't been accurate for a while, and the split of work between multi_planner() and CreatePhysicalPlan() doesn't seem perfect. So rename to CreateDistributedPlan() and move a bit more logic in there.pull/1134/head
parent
557ccc6fda
commit
7681f6ab9d
|
@ -39,7 +39,9 @@ static void CheckNodeIsDumpable(Node *node);
|
|||
static char * GetMultiPlanString(PlannedStmt *result);
|
||||
static PlannedStmt * MultiQueryContainerNode(PlannedStmt *result,
|
||||
struct MultiPlan *multiPlan);
|
||||
static struct MultiPlan * CreatePhysicalPlan(Query *originalQuery, Query *query,
|
||||
static struct PlannedStmt * CreateDistributedPlan(PlannedStmt *localPlan,
|
||||
Query *originalQuery,
|
||||
Query *query,
|
||||
RelationRestrictionContext *
|
||||
restrictionContext);
|
||||
static RelationRestrictionContext * CreateAndPushRestrictionContext(void);
|
||||
|
@ -100,11 +102,8 @@ multi_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
|
|||
|
||||
if (needsDistributedPlanning)
|
||||
{
|
||||
MultiPlan *physicalPlan = CreatePhysicalPlan(originalQuery, parse,
|
||||
result = CreateDistributedPlan(result, originalQuery, parse,
|
||||
restrictionContext);
|
||||
|
||||
/* store required data into the planned statement */
|
||||
result = MultiQueryContainerNode(result, physicalPlan);
|
||||
}
|
||||
}
|
||||
PG_CATCH();
|
||||
|
@ -122,14 +121,14 @@ multi_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
|
|||
|
||||
|
||||
/*
|
||||
* CreatePhysicalPlan encapsulates the logic needed to transform a particular
|
||||
* query into a physical plan. For modifications, queries immediately enter
|
||||
* CreateDistributedPlan encapsulates the logic needed to transform a particular
|
||||
* query into a distributed plan. For modifications, queries immediately enter
|
||||
* the physical planning stage, since they are essentially "routed" to remote
|
||||
* target shards. SELECT queries go through the full logical plan/optimize/
|
||||
* physical plan process needed to produce distributed query plans.
|
||||
*/
|
||||
static MultiPlan *
|
||||
CreatePhysicalPlan(Query *originalQuery, Query *query,
|
||||
static PlannedStmt *
|
||||
CreateDistributedPlan(PlannedStmt *localPlan, Query *originalQuery, Query *query,
|
||||
RelationRestrictionContext *restrictionContext)
|
||||
{
|
||||
MultiPlan *physicalPlan = MultiRouterPlanCreate(originalQuery, query,
|
||||
|
@ -153,7 +152,8 @@ CreatePhysicalPlan(Query *originalQuery, Query *query,
|
|||
physicalPlan = MultiPhysicalPlanCreate(logicalPlan);
|
||||
}
|
||||
|
||||
return physicalPlan;
|
||||
/* store required data into the planned statement */
|
||||
return MultiQueryContainerNode(localPlan, physicalPlan);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue