Rename planContext->parse to planContext->query

use-plancontext-more
Jelte Fennema 2020-01-06 12:56:08 +01:00
parent d4352646b9
commit 7c76a5ab95
3 changed files with 15 additions and 18 deletions

View File

@ -128,7 +128,7 @@ distributed_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
bool fastPathRouterQuery = false;
Const *distributionKeyValue = NULL;
DistributedPlanningContext planContext = {
.parse = parse,
.query = parse,
.cursorOptions = cursorOptions,
.boundParams = boundParams,
};
@ -234,7 +234,7 @@ distributed_planner(Query *parse, int cursorOptions, ParamListInfo boundParams)
* restriction information per table and parse tree transformations made by
* postgres' planner.
*/
planContext.plan = standard_planner(planContext.parse,
planContext.plan = standard_planner(planContext.query,
planContext.cursorOptions,
planContext.boundParams);
if (needsDistributedPlanning)
@ -548,7 +548,7 @@ PlanFastPathDistributedStmt(DistributedPlanningContext *planContext,
planContext->plannerRestrictionContext->fastPathRestrictionContext->
distributionKeyValue = distributionKeyValue;
planContext->plan = FastPathPlanner(planContext->originalQuery, planContext->parse,
planContext->plan = FastPathPlanner(planContext->originalQuery, planContext->query,
planContext->boundParams);
return CreateDistributedPlannedStmt(planContext);
@ -565,7 +565,7 @@ PlanDistributedStmt(DistributedPlanningContext *planContext,
int rteIdCounter)
{
/* may've inlined new relation rtes */
rangeTableList = ExtractRangeTableEntryList(planContext->parse);
rangeTableList = ExtractRangeTableEntryList(planContext->query);
rteIdCounter = AssignRTEIdentities(rangeTableList, rteIdCounter);
@ -615,11 +615,8 @@ CreateDistributedPlannedStmt(DistributedPlanningContext *planContext)
planContext->plannerRestrictionContext->joinRestrictionContext =
RemoveDuplicateJoinRestrictions(joinRestrictionContext);
DistributedPlan *distributedPlan =
CreateDistributedPlan(planId, planContext->originalQuery, planContext->parse,
planContext->boundParams,
hasUnresolvedParams,
planContext->plannerRestrictionContext);
DistributedPlan *distributedPlan = CreateDistributedPlan(planId, planContext,
hasUnresolvedParams);
/*
* If no plan was generated, prepare a generic error to be emitted.

View File

@ -130,19 +130,19 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
return NULL;
}
if (planContext->parse == NULL)
if (planContext->query == NULL)
{
/* no query (mostly here to be defensive) */
return NULL;
}
if (planContext->parse->commandType != CMD_SELECT)
if (planContext->query->commandType != CMD_SELECT)
{
/* not a SELECT */
return NULL;
}
FromExpr *joinTree = planContext->parse->jointree;
FromExpr *joinTree = planContext->query->jointree;
if (joinTree == NULL)
{
/* no join tree (mostly here to be defensive) */
@ -172,7 +172,7 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
if (IsA(reference, RangeTblRef))
{
RangeTblEntry *rtentry = rt_fetch(reference->rtindex,
planContext->parse->rtable);
planContext->query->rtable);
if (rtentry->rtekind != RTE_RESULT)
{
/* e.g. SELECT f() FROM rel */
@ -201,8 +201,8 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
#endif
}
targetList = planContext->parse->targetList;
if (list_length(planContext->parse->targetList) != 1)
targetList = planContext->query->targetList;
if (list_length(planContext->query->targetList) != 1)
{
/* multiple target list items */
return NULL;
@ -365,7 +365,7 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
ereport(DEBUG1, (errmsg("pushing down the function call")));
queryString = makeStringInfo();
pg_get_query_def(planContext->parse, queryString);
pg_get_query_def(planContext->query, queryString);
task = CitusMakeNode(Task);
task->taskType = SELECT_TASK;
@ -376,7 +376,7 @@ TryToDelegateFunctionCall(DistributedPlanningContext *planContext)
job = CitusMakeNode(Job);
job->jobId = UniqueJobId();
job->jobQuery = planContext->parse;
job->jobQuery = planContext->query;
job->taskList = list_make1(task);
distributedPlan = CitusMakeNode(DistributedPlan);

View File

@ -133,7 +133,7 @@ typedef struct DistributedPlanningContext
{
/* The parsed query that is given to the planner. It is a slightly modified
* to work with the standard_planner */
Query *parse;
Query *query;
/* A copy of the original parsed query that is given to the planner. This
* doesn't contain most of the changes that are made to parse. There's one