inital changes

pull/7643/head
paragjain 2024-07-04 07:08:26 +00:00
parent 58fef24142
commit 7ad8d711cd
1 changed files with 12 additions and 0 deletions

View File

@ -1005,12 +1005,18 @@ DeferErrorIfRoutableMergeNotSupported(Query *query, List *rangeTableList,
List *localTablesList = NIL; List *localTablesList = NIL;
RangeTblEntry *rangeTableEntry = NULL; RangeTblEntry *rangeTableEntry = NULL;
bool areAllDistTablesSingleSharded = true;
foreach_ptr(rangeTableEntry, rangeTableList) foreach_ptr(rangeTableEntry, rangeTableList)
{ {
Oid relationId = rangeTableEntry->relid; Oid relationId = rangeTableEntry->relid;
if (IsCitusTableType(relationId, DISTRIBUTED_TABLE)) if (IsCitusTableType(relationId, DISTRIBUTED_TABLE))
{ {
if (!IsCitusTableType(relationId, SINGLE_SHARD_DISTRIBUTED))
{
areAllDistTablesSingleSharded = false;
}
distTablesList = lappend(distTablesList, rangeTableEntry); distTablesList = lappend(distTablesList, rangeTableEntry);
} }
else if (IsCitusTableType(relationId, REFERENCE_TABLE)) else if (IsCitusTableType(relationId, REFERENCE_TABLE))
@ -1061,6 +1067,12 @@ DeferErrorIfRoutableMergeNotSupported(Query *query, List *rangeTableList,
/* Ensure all distributed tables are indeed co-located */ /* Ensure all distributed tables are indeed co-located */
if (!AllDistributedRelationsInRTEListColocated(distTablesList)) if (!AllDistributedRelationsInRTEListColocated(distTablesList))
{ {
/* All distributed tables are colocated and single sharded so we can push down to workers */
if (areAllDistTablesSingleSharded)
{
return NULL;
}
ereport(DEBUG1, (errmsg("Distributed tables are not co-located, try " ereport(DEBUG1, (errmsg("Distributed tables are not co-located, try "
"repartitioning"))); "repartitioning")));
return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED, return DeferredError(ERRCODE_FEATURE_NOT_SUPPORTED,