mirror of https://github.com/citusdata/citus.git
Refactor TargetListOnPartitionColumn
parent
13ff1e2b40
commit
bb26c3b9f7
|
@ -206,13 +206,11 @@ FindNodeMatchingCheckFunction(Node *node, CheckNodeFunc checker)
|
||||||
bool
|
bool
|
||||||
TargetListOnPartitionColumn(Query *query, List *targetEntryList)
|
TargetListOnPartitionColumn(Query *query, List *targetEntryList)
|
||||||
{
|
{
|
||||||
bool targetListOnPartitionColumn = false;
|
|
||||||
List *compositeFieldList = NIL;
|
List *compositeFieldList = NIL;
|
||||||
|
|
||||||
ListCell *targetEntryCell = NULL;
|
TargetEntry *targetEntry = NULL;
|
||||||
foreach(targetEntryCell, targetEntryList)
|
foreach_ptr(targetEntry, targetEntryList)
|
||||||
{
|
{
|
||||||
TargetEntry *targetEntry = (TargetEntry *) lfirst(targetEntryCell);
|
|
||||||
Expr *targetExpression = targetEntry->expr;
|
Expr *targetExpression = targetEntry->expr;
|
||||||
|
|
||||||
bool isPartitionColumn = IsPartitionColumn(targetExpression, query);
|
bool isPartitionColumn = IsPartitionColumn(targetExpression, query);
|
||||||
|
@ -240,36 +238,29 @@ TargetListOnPartitionColumn(Query *query, List *targetEntryList)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
targetListOnPartitionColumn = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check composite fields */
|
/* check composite fields */
|
||||||
if (!targetListOnPartitionColumn)
|
bool fullCompositeFieldList = FullCompositeFieldList(compositeFieldList);
|
||||||
|
if (fullCompositeFieldList)
|
||||||
{
|
{
|
||||||
bool fullCompositeFieldList = FullCompositeFieldList(compositeFieldList);
|
return true;
|
||||||
if (fullCompositeFieldList)
|
|
||||||
{
|
|
||||||
targetListOnPartitionColumn = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We could still behave as if the target list is on partition column if
|
* We could still behave as if the target list is on partition column if
|
||||||
* range table entries don't contain a distributed table.
|
* range table entries don't contain a distributed table.
|
||||||
*/
|
*/
|
||||||
if (!targetListOnPartitionColumn)
|
if (!FindNodeMatchingCheckFunctionInRangeTableList(query->rtable,
|
||||||
|
IsDistributedTableRTE))
|
||||||
{
|
{
|
||||||
if (!FindNodeMatchingCheckFunctionInRangeTableList(query->rtable,
|
return true;
|
||||||
IsDistributedTableRTE))
|
|
||||||
{
|
|
||||||
targetListOnPartitionColumn = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return targetListOnPartitionColumn;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue