update pg and citus

moonshot/custom-path
Nils Dijk 2021-01-04 19:07:25 +01:00
parent b5ac6d2048
commit 6bc9209baf
No known key found for this signature in database
GPG Key ID: CA1177EF9434F241
2 changed files with 20 additions and 13 deletions

View File

@ -133,15 +133,20 @@ static List * TranslatedVars(PlannerInfo *root, int relationIndex);
/* Distributed planner hook */ /* Distributed planner hook */
PlannedStmt * PlannedStmt *
distributed_planner(Query *parse, distributed_planner(Query *parse,
#if PG_VERSION_NUM >= PG_VERSION_13 #if PG_VERSION_NUM >= PG_VERSION_13
const char *query_string, const char *query_string,
#endif #endif
int cursorOptions, int cursorOptions,
ParamListInfo boundParams) ParamListInfo boundParams)
{ {
if (UseCustomPath) if (UseCustomPath)
{ {
return standard_planner(parse, cursorOptions, boundParams); return standard_planner(parse,
#if PG_VERSION_NUM >= PG_VERSION_13
query_string,
#endif
cursorOptions,
boundParams);
} }
bool needsDistributedPlanning = false; bool needsDistributedPlanning = false;

View File

@ -151,7 +151,7 @@ CreateDistributedUnionPlan(PlannerInfo *root,
initStringInfo(&buf); initStringInfo(&buf);
pg_get_query_def(qc, &buf); pg_get_query_def(qc, &buf);
Task *sqlTask = CreateBasicTask(workerJob->jobId, i, SELECT_TASK, buf.data); Task *sqlTask = CreateBasicTask(workerJob->jobId, i, READ_TASK, buf.data);
sqlTask->anchorShardId = shardInterval->shardId; sqlTask->anchorShardId = shardInterval->shardId;
sqlTask->taskPlacementList = ActiveShardPlacementList(shardInterval->shardId); sqlTask->taskPlacementList = ActiveShardPlacementList(shardInterval->shardId);
workerJob->taskList = lappend(workerJob->taskList, sqlTask); workerJob->taskList = lappend(workerJob->taskList, sqlTask);
@ -163,7 +163,7 @@ CreateDistributedUnionPlan(PlannerInfo *root,
distributedPlan->workerJob = workerJob; distributedPlan->workerJob = workerJob;
distributedPlan->modLevel = ROW_MODIFY_READONLY; distributedPlan->modLevel = ROW_MODIFY_READONLY;
distributedPlan->relationIdList = list_make1_oid(distUnion->sampleRelid); distributedPlan->relationIdList = list_make1_oid(distUnion->sampleRelid);
distributedPlan->hasReturning = true; distributedPlan->expectResults = true;
Plan *subPlan = NULL; Plan *subPlan = NULL;
int subPlanCount = 0; int subPlanCount = 0;
@ -302,12 +302,13 @@ PathBasedPlannerRelationHook(PlannerInfo *root,
foreach(pathCell, relOptInfo->pathlist) foreach(pathCell, relOptInfo->pathlist)
{ {
Path *originalPath = lfirst(pathCell); Path *originalPath = lfirst(pathCell);
pathCell->data.ptr_value = CustomPath *wrappedPath = WrapTableAccessWithDistributedUnion(
WrapTableAccessWithDistributedUnion(originalPath, originalPath,
TableColocationId(rte->relid), TableColocationId(rte->relid),
partitionValue, partitionValue,
rte->relid, rte->relid,
NIL); NIL);
SetListCellPtr(pathCell, wrappedPath);
} }
} }
@ -923,8 +924,9 @@ PathBasedPlannerGroupAgg(PlannerInfo *root,
ListCell *pathCell = NULL; ListCell *pathCell = NULL;
foreach(pathCell, output_rel->pathlist) foreach(pathCell, output_rel->pathlist)
{ {
Path *originalPath = pathCell->data.ptr_value; Path *originalPath = lfirst(pathCell);
pathCell->data.ptr_value = OptimizeGroupAgg(root, originalPath); Path *optimizedGroupAdd = OptimizeGroupAgg(root, originalPath);
SetListCellPtr(pathCell, optimizedGroupAdd);
} }
} }