mirror of https://github.com/citusdata/citus.git
we should consider all kinds of tables as colocated if their relation ids are same
parent
0668246a8a
commit
15b62979e2
|
@ -171,6 +171,7 @@ static bool FindQueryContainingRTEIdentityInternal(Node *node,
|
|||
|
||||
static int ParentCountPriorToAppendRel(List *appendRelList, AppendRelInfo *appendRelInfo);
|
||||
|
||||
static bool AllRelationsSame(List *relationList);
|
||||
|
||||
/*
|
||||
* AllDistributionKeysInQueryAreEqual returns true if either
|
||||
|
@ -1960,6 +1961,31 @@ AllDistributedRelationsInRTEListColocated(List *rangeTableEntryList)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* AllRelationsSame determines whether all of the relations are the same.
|
||||
*/
|
||||
static bool
|
||||
AllRelationsSame(List *relationList)
|
||||
{
|
||||
if (relationList == NULL || list_length(relationList) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Oid firstRelationId = linitial_oid(relationList);
|
||||
Oid relationId = InvalidOid;
|
||||
foreach_oid(relationId, relationList)
|
||||
{
|
||||
if (relationId != firstRelationId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* AllDistributedRelationsInListColocated determines whether all of the
|
||||
* distributed relations in the given list are co-located.
|
||||
|
@ -1967,6 +1993,11 @@ AllDistributedRelationsInRTEListColocated(List *rangeTableEntryList)
|
|||
bool
|
||||
AllDistributedRelationsInListColocated(List *relationList)
|
||||
{
|
||||
if (AllRelationsSame(relationList))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
int initialColocationId = INVALID_COLOCATION_ID;
|
||||
Oid relationId = InvalidOid;
|
||||
|
||||
|
|
Loading…
Reference in New Issue