mirror of https://github.com/citusdata/citus.git
Minor formatting changes as per code-review
parent
509ffbfc54
commit
01bdab891b
|
@ -139,7 +139,7 @@ static bool JoinOnPartitionColumn(Query *query);
|
||||||
static void ErrorIfUnsupportedShardDistribution(Query *query);
|
static void ErrorIfUnsupportedShardDistribution(Query *query);
|
||||||
static List * RelationIdList(Query *query);
|
static List * RelationIdList(Query *query);
|
||||||
static bool CoPartitionedTables(Oid firstRelationId, Oid secondRelationId);
|
static bool CoPartitionedTables(Oid firstRelationId, Oid secondRelationId);
|
||||||
static bool ShardIntervalsEqual(FmgrInfo* comparisonFunction, ShardInterval *firstInterval,
|
static bool ShardIntervalsEqual(FmgrInfo *comparisonFunction, ShardInterval *firstInterval,
|
||||||
ShardInterval *secondInterval);
|
ShardInterval *secondInterval);
|
||||||
static void ErrorIfUnsupportedFilters(Query *subquery);
|
static void ErrorIfUnsupportedFilters(Query *subquery);
|
||||||
static bool EqualOpExpressionLists(List *firstOpExpressionList,
|
static bool EqualOpExpressionLists(List *firstOpExpressionList,
|
||||||
|
@ -3515,8 +3515,8 @@ CoPartitionedTables(Oid firstRelationId, Oid secondRelationId)
|
||||||
ShardInterval *secondInterval = &sortedSecondIntervalArray[intervalIndex];
|
ShardInterval *secondInterval = &sortedSecondIntervalArray[intervalIndex];
|
||||||
|
|
||||||
bool shardIntervalsEqual = ShardIntervalsEqual(comparisonFunction,
|
bool shardIntervalsEqual = ShardIntervalsEqual(comparisonFunction,
|
||||||
firstInterval,
|
firstInterval,
|
||||||
secondInterval);
|
secondInterval);
|
||||||
if (!shardIntervalsEqual)
|
if (!shardIntervalsEqual)
|
||||||
{
|
{
|
||||||
coPartitionedTables = false;
|
coPartitionedTables = false;
|
||||||
|
@ -3529,11 +3529,12 @@ CoPartitionedTables(Oid firstRelationId, Oid secondRelationId)
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ShardIntervalsEqual checks if given shard intervals have equal min/max values.
|
* ShardIntervalsEqual checks if given shard intervals have equal min/max values under
|
||||||
|
* some comparison function
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
ShardIntervalsEqual(FmgrInfo* comparisonFunction, ShardInterval *firstInterval,
|
ShardIntervalsEqual(FmgrInfo *comparisonFunction, ShardInterval *firstInterval,
|
||||||
ShardInterval *secondInterval)
|
ShardInterval *secondInterval)
|
||||||
{
|
{
|
||||||
bool shardIntervalsEqual = false;
|
bool shardIntervalsEqual = false;
|
||||||
Datum firstMin = 0;
|
Datum firstMin = 0;
|
||||||
|
|
|
@ -2003,7 +2003,7 @@ SubquerySqlTaskList(Job *job)
|
||||||
uint32 anchorRangeTableId = 0;
|
uint32 anchorRangeTableId = 0;
|
||||||
uint32 rangeTableIndex = 0;
|
uint32 rangeTableIndex = 0;
|
||||||
const uint32 fragmentSize = sizeof(RangeTableFragment);
|
const uint32 fragmentSize = sizeof(RangeTableFragment);
|
||||||
uint64 maxTableSize = 0;
|
uint64 maxPrunedTableSize = 0;
|
||||||
|
|
||||||
/* find filters on partition columns */
|
/* find filters on partition columns */
|
||||||
ExtractQueryWalker((Node *) subquery, &queryList);
|
ExtractQueryWalker((Node *) subquery, &queryList);
|
||||||
|
@ -2045,7 +2045,7 @@ SubquerySqlTaskList(Job *job)
|
||||||
uint32 tableId = rangeTableIndex + 1; /* tableId starts from 1 */
|
uint32 tableId = rangeTableIndex + 1; /* tableId starts from 1 */
|
||||||
uint32 finalShardCount = 0;
|
uint32 finalShardCount = 0;
|
||||||
uint32 shardIndex = 0;
|
uint32 shardIndex = 0;
|
||||||
uint64 tableSize = 0;
|
uint64 prunedTableSize = 0;
|
||||||
|
|
||||||
if (opExpressionList != NIL)
|
if (opExpressionList != NIL)
|
||||||
{
|
{
|
||||||
|
@ -2073,9 +2073,6 @@ SubquerySqlTaskList(Job *job)
|
||||||
for (shardIndex = 0; shardIndex < finalShardCount; shardIndex++)
|
for (shardIndex = 0; shardIndex < finalShardCount; shardIndex++)
|
||||||
{
|
{
|
||||||
ShardInterval *shardInterval = sortedIntervalArray[shardIndex];
|
ShardInterval *shardInterval = sortedIntervalArray[shardIndex];
|
||||||
|
|
||||||
tableSize += ShardLength(shardInterval->shardId);
|
|
||||||
|
|
||||||
RangeTableFragment *shardFragment = palloc0(fragmentSize);
|
RangeTableFragment *shardFragment = palloc0(fragmentSize);
|
||||||
shardFragment->fragmentReference = &(shardInterval->shardId);
|
shardFragment->fragmentReference = &(shardInterval->shardId);
|
||||||
shardFragment->fragmentType = CITUS_RTE_RELATION;
|
shardFragment->fragmentType = CITUS_RTE_RELATION;
|
||||||
|
@ -2095,10 +2092,17 @@ SubquerySqlTaskList(Job *job)
|
||||||
/* get next fragment for the first relation list */
|
/* get next fragment for the first relation list */
|
||||||
fragmentCombinationCell = lnext(fragmentCombinationCell);
|
fragmentCombinationCell = lnext(fragmentCombinationCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prunedTableSize += ShardLength(shardInterval->shardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (anchorRangeTableId == 0 || tableSize > maxTableSize){
|
/*
|
||||||
maxTableSize = tableSize;
|
* The shards of the anchor table are not shipped between workers if it can be
|
||||||
|
* avoided. By picking the largest table to be the anchor we're reducing network
|
||||||
|
* traffic.
|
||||||
|
*/
|
||||||
|
if (anchorRangeTableId == 0 || prunedTableSize > maxPrunedTableSize){
|
||||||
|
maxTableSize = prunedTableSize;
|
||||||
anchorRangeTableId = tableId;
|
anchorRangeTableId = tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue