diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-13 13:18:02 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-13 13:18:02 -0400 |
commit | 19832753f1bb052c5fe10328939b670507df7a93 (patch) | |
tree | 8b2b5e15bcd736bc81147ef0011e4d2425be8a75 /src/backend/executor | |
parent | e23bae82cf3d76365d48b1204ca4c631bac7550d (diff) | |
download | postgresql-19832753f1bb052c5fe10328939b670507df7a93.tar.gz postgresql-19832753f1bb052c5fe10328939b670507df7a93.zip |
Fix some ill-chosen names for globally-visible partition support functions.
"compute_hash_value" is particularly gratuitously generic, but IMO
all of these ought to have names clearly related to partitioning.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/execPartition.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/backend/executor/execPartition.c b/src/backend/executor/execPartition.c index 4eeee7c5e7f..7a4665cc4ee 100644 --- a/src/backend/executor/execPartition.c +++ b/src/backend/executor/execPartition.c @@ -1085,17 +1085,20 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) int part_index = -1; PartitionKey key = RelationGetPartitionKey(relation); PartitionDesc partdesc = RelationGetPartitionDesc(relation); + PartitionBoundInfo boundinfo = partdesc->boundinfo; /* Route as appropriate based on partitioning strategy. */ switch (key->strategy) { case PARTITION_STRATEGY_HASH: { - PartitionBoundInfo boundinfo = partdesc->boundinfo; - int greatest_modulus = get_hash_partition_greatest_modulus(boundinfo); - uint64 rowHash = compute_hash_value(key->partnatts, - key->partsupfunc, - values, isnull); + int greatest_modulus; + uint64 rowHash; + + greatest_modulus = get_hash_partition_greatest_modulus(boundinfo); + rowHash = compute_partition_hash_value(key->partnatts, + key->partsupfunc, + values, isnull); part_index = boundinfo->indexes[rowHash % greatest_modulus]; } @@ -1104,8 +1107,8 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) case PARTITION_STRATEGY_LIST: if (isnull[0]) { - if (partition_bound_accepts_nulls(partdesc->boundinfo)) - part_index = partdesc->boundinfo->null_index; + if (partition_bound_accepts_nulls(boundinfo)) + part_index = boundinfo->null_index; } else { @@ -1113,10 +1116,10 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) bound_offset = partition_list_bsearch(key->partsupfunc, key->partcollation, - partdesc->boundinfo, + boundinfo, values[0], &equal); if (bound_offset >= 0 && equal) - part_index = partdesc->boundinfo->indexes[bound_offset]; + part_index = boundinfo->indexes[bound_offset]; } break; @@ -1143,7 +1146,7 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) { bound_offset = partition_range_datum_bsearch(key->partsupfunc, key->partcollation, - partdesc->boundinfo, + boundinfo, key->partnatts, values, &equal); @@ -1154,7 +1157,7 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) * bound of the partition we're looking for, if there * actually exists one. */ - part_index = partdesc->boundinfo->indexes[bound_offset + 1]; + part_index = boundinfo->indexes[bound_offset + 1]; } } break; @@ -1169,7 +1172,7 @@ get_partition_for_tuple(Relation relation, Datum *values, bool *isnull) * the default partition, if there is one. */ if (part_index < 0) - part_index = partdesc->boundinfo->default_index; + part_index = boundinfo->default_index; return part_index; } |