mirror of https://github.com/citusdata/citus.git
Record the colocation id on the DU
parent
8d73ff6779
commit
b361386e05
|
@ -22,13 +22,12 @@
|
||||||
|
|
||||||
static Plan * CreateDistributedUnionPlan(PlannerInfo *root, RelOptInfo *rel, struct CustomPath *best_path, List *tlist, List *clauses, List *custom_plans);
|
static Plan * CreateDistributedUnionPlan(PlannerInfo *root, RelOptInfo *rel, struct CustomPath *best_path, List *tlist, List *clauses, List *custom_plans);
|
||||||
static List * ReparameterizeDistributedUnion(PlannerInfo *root, List *custom_private, RelOptInfo *child_rel);
|
static List * ReparameterizeDistributedUnion(PlannerInfo *root, List *custom_private, RelOptInfo *child_rel);
|
||||||
static CustomPath * WrapTableAccessWithDistributedUnion(Path *originalPath);
|
static CustomPath * WrapTableAccessWithDistributedUnion(PlannerInfo *root, Path *originalPath);
|
||||||
static Index VarnoFromFirstTargetEntry(List *tlist);
|
static Index VarnoFromFirstTargetEntry(List *tlist);
|
||||||
static Query * GetQueryFromPath(PlannerInfo *root, Path *path, List *tlist, List *clauses);
|
static Query * GetQueryFromPath(PlannerInfo *root, Path *path, List *tlist, List *clauses);
|
||||||
static List * ShardIntervalListToRelationShardList(List *shardIntervalList);
|
static List * ShardIntervalListToRelationShardList(List *shardIntervalList);
|
||||||
|
|
||||||
static bool IsDistributedUnion(Path *path);
|
static bool IsDistributedUnion(Path *path);
|
||||||
static uint32 ColocationGroupForDistributedUnion(Path *path);
|
|
||||||
|
|
||||||
typedef struct DistributedUnionPath
|
typedef struct DistributedUnionPath
|
||||||
{
|
{
|
||||||
|
@ -36,6 +35,8 @@ typedef struct DistributedUnionPath
|
||||||
|
|
||||||
/* path to be executed on the worker */
|
/* path to be executed on the worker */
|
||||||
Path *worker_path;
|
Path *worker_path;
|
||||||
|
|
||||||
|
uint32 colocationId;
|
||||||
} DistributedUnionPath;
|
} DistributedUnionPath;
|
||||||
|
|
||||||
const CustomPathMethods distributedUnionMethods = {
|
const CustomPathMethods distributedUnionMethods = {
|
||||||
|
@ -46,7 +47,7 @@ const CustomPathMethods distributedUnionMethods = {
|
||||||
|
|
||||||
|
|
||||||
CustomPath *
|
CustomPath *
|
||||||
WrapTableAccessWithDistributedUnion(Path *originalPath)
|
WrapTableAccessWithDistributedUnion(PlannerInfo *root, Path *originalPath)
|
||||||
{
|
{
|
||||||
DistributedUnionPath *distUnion = newNode(sizeof(DistributedUnionPath), T_CustomPath);
|
DistributedUnionPath *distUnion = newNode(sizeof(DistributedUnionPath), T_CustomPath);
|
||||||
distUnion->custom_path.path.pathtype = T_CustomScan;
|
distUnion->custom_path.path.pathtype = T_CustomScan;
|
||||||
|
@ -63,6 +64,10 @@ WrapTableAccessWithDistributedUnion(Path *originalPath)
|
||||||
|
|
||||||
distUnion->worker_path = originalPath;
|
distUnion->worker_path = originalPath;
|
||||||
|
|
||||||
|
/* collect the colocation group of the table */
|
||||||
|
RangeTblEntry *rte = root->simple_rte_array[originalPath->parent->relid];
|
||||||
|
distUnion->colocationId = TableColocationId(rte->relid);
|
||||||
|
|
||||||
return (CustomPath *) distUnion;
|
return (CustomPath *) distUnion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,16 +183,6 @@ IsDistributedUnion(Path *path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint32
|
|
||||||
ColocationGroupForDistributedUnion(Path *path)
|
|
||||||
{
|
|
||||||
Assert(IsDistributedUnion(path));
|
|
||||||
DistributedUnionPath *distUnion = (DistributedUnionPath *) path;
|
|
||||||
/* TODO actually retreive the right colocation id for the Distributed Union */
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PathBasedPlannerRelationHook(PlannerInfo *root, RelOptInfo *relOptInfo, Index restrictionIndex, RangeTblEntry *rte)
|
PathBasedPlannerRelationHook(PlannerInfo *root, RelOptInfo *relOptInfo, Index restrictionIndex, RangeTblEntry *rte)
|
||||||
{
|
{
|
||||||
|
@ -202,7 +197,7 @@ PathBasedPlannerRelationHook(PlannerInfo *root, RelOptInfo *relOptInfo, Index re
|
||||||
foreach(pathCell, relOptInfo->pathlist)
|
foreach(pathCell, relOptInfo->pathlist)
|
||||||
{
|
{
|
||||||
Path *originalPath = lfirst(pathCell);
|
Path *originalPath = lfirst(pathCell);
|
||||||
pathCell->data.ptr_value = WrapTableAccessWithDistributedUnion(originalPath);
|
pathCell->data.ptr_value = WrapTableAccessWithDistributedUnion(root, originalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue