mirror of https://github.com/citusdata/citus.git
Rename AllRelations.. functions to AllDistributedRelations.. (#6789)
Because they're only interested in distributed tables. Even more, this replaces HasDistributionKey() check with IsCitusTableType(DISTRIBUTED_TABLE) because this doesn't make a difference on main and sounds slightly more intuitive. Plus, this would also allow safely using this function in https://github.com/citusdata/citus/pull/6773.pull/6786/head
parent
4960ced175
commit
e1f1d63050
|
@ -229,7 +229,7 @@ ErrorIfDistTablesNotColocated(Query *parse, List *distTablesList,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All distributed tables must be colocated */
|
/* All distributed tables must be colocated */
|
||||||
if (!AllRelationsInRTEListColocated(distTablesList))
|
if (!AllDistributedRelationsInRTEListColocated(distTablesList))
|
||||||
{
|
{
|
||||||
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,
|
||||||
"For MERGE command, all the distributed tables "
|
"For MERGE command, all the distributed tables "
|
||||||
|
|
|
@ -151,9 +151,10 @@ static void ListConcatUniqueAttributeClassMemberLists(AttributeEquivalenceClass
|
||||||
secondClass);
|
secondClass);
|
||||||
static Var * PartitionKeyForRTEIdentityInQuery(Query *query, int targetRTEIndex,
|
static Var * PartitionKeyForRTEIdentityInQuery(Query *query, int targetRTEIndex,
|
||||||
Index *partitionKeyIndex);
|
Index *partitionKeyIndex);
|
||||||
static bool AllRelationsInRestrictionContextColocated(RelationRestrictionContext *
|
static bool AllDistributedRelationsInRestrictionContextColocated(
|
||||||
|
RelationRestrictionContext *
|
||||||
restrictionContext);
|
restrictionContext);
|
||||||
static bool AllRelationsInListColocated(List *relationList);
|
static bool AllDistributedRelationsInListColocated(List *relationList);
|
||||||
static bool IsNotSafeRestrictionToRecursivelyPlan(Node *node);
|
static bool IsNotSafeRestrictionToRecursivelyPlan(Node *node);
|
||||||
static JoinRestrictionContext * FilterJoinRestrictionContext(
|
static JoinRestrictionContext * FilterJoinRestrictionContext(
|
||||||
JoinRestrictionContext *joinRestrictionContext, Relids
|
JoinRestrictionContext *joinRestrictionContext, Relids
|
||||||
|
@ -384,7 +385,7 @@ SafeToPushdownUnionSubquery(Query *originalQuery,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AllRelationsInRestrictionContextColocated(restrictionContext))
|
if (!AllDistributedRelationsInRestrictionContextColocated(restrictionContext))
|
||||||
{
|
{
|
||||||
/* distribution columns are equal, but tables are not co-located */
|
/* distribution columns are equal, but tables are not co-located */
|
||||||
return false;
|
return false;
|
||||||
|
@ -1920,11 +1921,12 @@ FindQueryContainingRTEIdentityInternal(Node *node,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AllRelationsInRestrictionContextColocated determines whether all of the relations in the
|
* AllDistributedRelationsInRestrictionContextColocated determines whether all of the
|
||||||
* given relation restrictions list are co-located.
|
* distributed relations in the given relation restrictions list are co-located.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
AllRelationsInRestrictionContextColocated(RelationRestrictionContext *restrictionContext)
|
AllDistributedRelationsInRestrictionContextColocated(
|
||||||
|
RelationRestrictionContext *restrictionContext)
|
||||||
{
|
{
|
||||||
RelationRestriction *relationRestriction = NULL;
|
RelationRestriction *relationRestriction = NULL;
|
||||||
List *relationIdList = NIL;
|
List *relationIdList = NIL;
|
||||||
|
@ -1935,16 +1937,16 @@ AllRelationsInRestrictionContextColocated(RelationRestrictionContext *restrictio
|
||||||
relationIdList = lappend_oid(relationIdList, relationRestriction->relationId);
|
relationIdList = lappend_oid(relationIdList, relationRestriction->relationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AllRelationsInListColocated(relationIdList);
|
return AllDistributedRelationsInListColocated(relationIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AllRelationsInRTEListColocated determines whether all of the relations in the
|
* AllDistributedRelationsInRTEListColocated determines whether all of the
|
||||||
* given RangeTableEntry list are co-located.
|
* distributed relations in the given RangeTableEntry list are co-located.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
AllRelationsInRTEListColocated(List *rangeTableEntryList)
|
AllDistributedRelationsInRTEListColocated(List *rangeTableEntryList)
|
||||||
{
|
{
|
||||||
RangeTblEntry *rangeTableEntry = NULL;
|
RangeTblEntry *rangeTableEntry = NULL;
|
||||||
List *relationIdList = NIL;
|
List *relationIdList = NIL;
|
||||||
|
@ -1954,24 +1956,31 @@ AllRelationsInRTEListColocated(List *rangeTableEntryList)
|
||||||
relationIdList = lappend_oid(relationIdList, rangeTableEntry->relid);
|
relationIdList = lappend_oid(relationIdList, rangeTableEntry->relid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return AllRelationsInListColocated(relationIdList);
|
return AllDistributedRelationsInListColocated(relationIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AllRelationsInListColocated determines whether all of the relations in the
|
* AllDistributedRelationsInListColocated determines whether all of the
|
||||||
* given list are co-located.
|
* distributed relations in the given list are co-located.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
AllRelationsInListColocated(List *relationList)
|
AllDistributedRelationsInListColocated(List *relationList)
|
||||||
{
|
{
|
||||||
int initialColocationId = INVALID_COLOCATION_ID;
|
int initialColocationId = INVALID_COLOCATION_ID;
|
||||||
Oid relationId = InvalidOid;
|
Oid relationId = InvalidOid;
|
||||||
|
|
||||||
foreach_oid(relationId, relationList)
|
foreach_oid(relationId, relationList)
|
||||||
{
|
{
|
||||||
if (IsCitusTable(relationId) && !HasDistributionKey(relationId))
|
if (!IsCitusTable(relationId))
|
||||||
{
|
{
|
||||||
|
/* not interested in Postgres tables */
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsCitusTableType(relationId, DISTRIBUTED_TABLE))
|
||||||
|
{
|
||||||
|
/* not interested in non-distributed tables */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,5 +54,5 @@ extern RelationRestrictionContext * FilterRelationRestrictionContext(
|
||||||
RelationRestrictionContext *relationRestrictionContext,
|
RelationRestrictionContext *relationRestrictionContext,
|
||||||
Relids
|
Relids
|
||||||
queryRteIdentities);
|
queryRteIdentities);
|
||||||
extern bool AllRelationsInRTEListColocated(List *rangeTableEntryList);
|
extern bool AllDistributedRelationsInRTEListColocated(List *rangeTableEntryList);
|
||||||
#endif /* RELATION_RESTRICTION_EQUIVALENCE_H */
|
#endif /* RELATION_RESTRICTION_EQUIVALENCE_H */
|
||||||
|
|
Loading…
Reference in New Issue