mirror of https://github.com/citusdata/citus.git
Avoid calling hash functions with InvalidOid collation
I opted to try find the correct collation as opposed to DEFAULT_COLLATION_OIDread_write_etc
parent
b9bb4388d3
commit
90179cf615
|
@ -84,7 +84,7 @@ worker_hash(PG_FUNCTION_ARGS)
|
|||
fmgr_info_copy(hashFunction, &(typeEntry->hash_proc_finfo), CurrentMemoryContext);
|
||||
|
||||
/* calculate hash value */
|
||||
hashedValueDatum = FunctionCall1(hashFunction, valueDatum);
|
||||
hashedValueDatum = FunctionCall1Coll(hashFunction, PG_GET_COLLATION(), valueDatum);
|
||||
|
||||
PG_RETURN_INT32(hashedValueDatum);
|
||||
}
|
||||
|
|
|
@ -253,7 +253,9 @@ FindShardInterval(Datum partitionColumnValue, DistTableCacheEntry *cacheEntry)
|
|||
|
||||
if (cacheEntry->partitionMethod == DISTRIBUTE_BY_HASH)
|
||||
{
|
||||
searchedValue = FunctionCall1(cacheEntry->hashFunction, partitionColumnValue);
|
||||
searchedValue = FunctionCall1Coll(cacheEntry->hashFunction,
|
||||
cacheEntry->partitionColumn->varcollid,
|
||||
partitionColumnValue);
|
||||
}
|
||||
|
||||
shardIndex = FindShardIntervalIndex(searchedValue, cacheEntry);
|
||||
|
|
|
@ -221,6 +221,7 @@ worker_hash_partition_table(PG_FUNCTION_ARGS)
|
|||
|
||||
partitionContext->hashFunction = hashFunction;
|
||||
partitionContext->partitionCount = partitionCount;
|
||||
partitionContext->collation = PG_GET_COLLATION();
|
||||
|
||||
/* we'll use binary search, we need the comparison function */
|
||||
if (!partitionContext->hasUniformHashDistribution)
|
||||
|
@ -1256,7 +1257,8 @@ HashPartitionId(Datum partitionValue, const void *context)
|
|||
ShardInterval **syntheticShardIntervalArray =
|
||||
hashPartitionContext->syntheticShardIntervalArray;
|
||||
FmgrInfo *comparisonFunction = hashPartitionContext->comparisonFunction;
|
||||
Datum hashDatum = FunctionCall1(hashFunction, partitionValue);
|
||||
Datum hashDatum = FunctionCall1Coll(hashFunction, hashPartitionContext->collation,
|
||||
partitionValue);
|
||||
int32 hashResult = 0;
|
||||
uint32 hashPartitionId = 0;
|
||||
|
||||
|
|
|
@ -79,6 +79,7 @@ typedef struct HashPartitionContext
|
|||
FmgrInfo *comparisonFunction;
|
||||
ShardInterval **syntheticShardIntervalArray;
|
||||
uint32 partitionCount;
|
||||
Oid collation;
|
||||
bool hasUniformHashDistribution;
|
||||
} HashPartitionContext;
|
||||
|
||||
|
|
Loading…
Reference in New Issue