Remove FastShardPruning method

With the other simplifications, it doesn't make sense to keep around.

Based on 93e3afc25c
pull/1385/head
Jason Petersen 2017-04-27 13:15:48 -06:00
parent 8afb4b9f33
commit 6dbd434f81
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
3 changed files with 4 additions and 26 deletions

View File

@ -2058,8 +2058,8 @@ TargetShardIntervalForModify(Query *query, DeferredErrorMessage **planningError)
Var *partitionColumn = PartitionColumn(distributedTableId, rangeTableId); Var *partitionColumn = PartitionColumn(distributedTableId, rangeTableId);
Const *partitionValueConst = ExtractInsertPartitionValue(query, partitionColumn); Const *partitionValueConst = ExtractInsertPartitionValue(query, partitionColumn);
Datum partitionValue = partitionValueConst->constvalue; Datum partitionValue = partitionValueConst->constvalue;
ShardInterval *shardInterval = FastShardPruning(distributedTableId, DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(distributedTableId);
partitionValue); ShardInterval *shardInterval = FindShardInterval(partitionValue, cacheEntry);
if (shardInterval != NULL) if (shardInterval != NULL)
{ {
@ -2152,28 +2152,6 @@ FastShardPruningPossible(CmdType commandType, char partitionMethod)
} }
/*
* FastShardPruning is a higher level API for FindShardInterval function. Given the
* relationId of the distributed table and partitionValue, FastShardPruning function finds
* the corresponding shard interval that the partitionValue should be in. FastShardPruning
* returns NULL if no ShardIntervals exist for the given partitionValue.
*/
ShardInterval *
FastShardPruning(Oid distributedTableId, Datum partitionValue)
{
DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(distributedTableId);
ShardInterval *shardInterval = NULL;
/*
* Call FindShardInterval to find the corresponding shard interval for the
* given partition value.
*/
shardInterval = FindShardInterval(partitionValue, cacheEntry);
return shardInterval;
}
/* /*
* QueryRestrictList returns the restriction clauses for the query. For a SELECT * QueryRestrictList returns the restriction clauses for the query. For a SELECT
* statement these are the where-clause expressions. For INSERT statements we * statement these are the where-clause expressions. For INSERT statements we

View File

@ -224,6 +224,7 @@ get_shard_id_for_distribution_column(PG_FUNCTION_ARGS)
char *distributionValueString = NULL; char *distributionValueString = NULL;
Datum inputDatum = 0; Datum inputDatum = 0;
Datum distributionValueDatum = 0; Datum distributionValueDatum = 0;
DistTableCacheEntry *cacheEntry = DistributedTableCacheEntry(relationId);
/* if given table is not reference table, distributionValue cannot be NULL */ /* if given table is not reference table, distributionValue cannot be NULL */
if (PG_ARGISNULL(1)) if (PG_ARGISNULL(1))
@ -243,7 +244,7 @@ get_shard_id_for_distribution_column(PG_FUNCTION_ARGS)
distributionValueDatum = StringToDatum(distributionValueString, distributionValueDatum = StringToDatum(distributionValueString,
distributionDataType); distributionDataType);
shardInterval = FastShardPruning(relationId, distributionValueDatum); shardInterval = FindShardInterval(distributionValueDatum, cacheEntry);
} }
else else
{ {

View File

@ -45,7 +45,6 @@ extern RangeTblEntry * ExtractSelectRangeTableEntry(Query *query);
extern RangeTblEntry * ExtractInsertRangeTableEntry(Query *query); extern RangeTblEntry * ExtractInsertRangeTableEntry(Query *query);
extern void AddShardIntervalRestrictionToSelect(Query *subqery, extern void AddShardIntervalRestrictionToSelect(Query *subqery,
ShardInterval *shardInterval); ShardInterval *shardInterval);
extern ShardInterval * FastShardPruning(Oid distributedTableId, Datum partitionValue);
#endif /* MULTI_ROUTER_PLANNER_H */ #endif /* MULTI_ROUTER_PLANNER_H */