aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeHash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeHash.c')
-rw-r--r--src/backend/executor/nodeHash.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index cfc6b960935..d9789d07195 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -1283,10 +1283,7 @@ static void
ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
{
HeapTupleData *statsTuple;
- Datum *values;
- int nvalues;
- float4 *numbers;
- int nnumbers;
+ AttStatsSlot sslot;
/* Do nothing if planner didn't identify the outer relation's join key */
if (!OidIsValid(node->skewTable))
@@ -1305,19 +1302,17 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
if (!HeapTupleIsValid(statsTuple))
return;
- if (get_attstatsslot(statsTuple, node->skewColType, node->skewColTypmod,
+ if (get_attstatsslot(&sslot, statsTuple,
STATISTIC_KIND_MCV, InvalidOid,
- NULL,
- &values, &nvalues,
- &numbers, &nnumbers))
+ ATTSTATSSLOT_VALUES | ATTSTATSSLOT_NUMBERS))
{
double frac;
int nbuckets;
FmgrInfo *hashfunctions;
int i;
- if (mcvsToUse > nvalues)
- mcvsToUse = nvalues;
+ if (mcvsToUse > sslot.nvalues)
+ mcvsToUse = sslot.nvalues;
/*
* Calculate the expected fraction of outer relation that will
@@ -1326,11 +1321,10 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
*/
frac = 0;
for (i = 0; i < mcvsToUse; i++)
- frac += numbers[i];
+ frac += sslot.numbers[i];
if (frac < SKEW_MIN_OUTER_FRACTION)
{
- free_attstatsslot(node->skewColType,
- values, nvalues, numbers, nnumbers);
+ free_attstatsslot(&sslot);
ReleaseSysCache(statsTuple);
return;
}
@@ -1392,7 +1386,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
int bucket;
hashvalue = DatumGetUInt32(FunctionCall1(&hashfunctions[0],
- values[i]));
+ sslot.values[i]));
/*
* While we have not hit a hole in the hashtable and have not hit
@@ -1426,8 +1420,7 @@ ExecHashBuildSkewHash(HashJoinTable hashtable, Hash *node, int mcvsToUse)
hashtable->spacePeak = hashtable->spaceUsed;
}
- free_attstatsslot(node->skewColType,
- values, nvalues, numbers, nnumbers);
+ free_attstatsslot(&sslot);
}
ReleaseSysCache(statsTuple);