MCPcopy Create free account
hub / github.com/apache/cloudberry / LookupTupleHashEntry

Function LookupTupleHashEntry

src/backend/executor/execGrouping.c:316–343  ·  view source on GitHub ↗

* Find or create a hashtable entry for the tuple group containing the * given tuple. The tuple must be the same type as the hashtable entries. * * If isnew is NULL, we do not create new entries; we return NULL if no * match is found. * * If hash is not NULL, we set it to the calculated hash value. This allows * callers access to the hash value even if no entry is returned. * * If isnew i

Source from the content-addressed store, hash-verified

314 * been zeroed.
315 */
316TupleHashEntry
317LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot,
318 bool *isnew, uint32 *hash)
319{
320 TupleHashEntry entry;
321 MemoryContext oldContext;
322 uint32 local_hash;
323
324 /* Need to run the hash functions in short-lived context */
325 oldContext = MemoryContextSwitchTo(hashtable->tempcxt);
326
327 /* set up data needed by hash and match functions */
328 hashtable->inputslot = slot;
329 hashtable->in_hash_funcs = hashtable->tab_hash_funcs;
330 hashtable->cur_eq_func = hashtable->tab_eq_func;
331
332 local_hash = TupleHashTableHash_internal(hashtable->hashtab, NULL);
333 entry = LookupTupleHashEntry_internal(hashtable, slot, isnew, local_hash);
334
335 if (hash != NULL)
336 *hash = local_hash;
337
338 Assert(entry == NULL || entry->hash == local_hash);
339
340 MemoryContextSwitchTo(oldContext);
341
342 return entry;
343}
344
345/*
346 * Compute the hash value for a tuple

Callers 4

setop_fill_hash_tableFunction · 0.85
ExecRecursiveUnionFunction · 0.85
lookup_hash_entriesFunction · 0.85
buildSubPlanHashFunction · 0.85

Calls 3

MemoryContextSwitchToFunction · 0.85

Tested by

no test coverage detected