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

Function LookupTupleHashEntry_internal

src/backend/executor/execGrouping.c:506–542  ·  view source on GitHub ↗

* Does the work of LookupTupleHashEntry and LookupTupleHashEntryHash. Useful * so that we can avoid switching the memory context multiple times for * LookupTupleHashEntry. * * NB: This function may or may not change the memory context. Caller is * expected to change it back. */

Source from the content-addressed store, hash-verified

504 * expected to change it back.
505 */
506static inline TupleHashEntry
507LookupTupleHashEntry_internal(TupleHashTable hashtable, TupleTableSlot *slot,
508 bool *isnew, uint32 hash)
509{
510 TupleHashEntryData *entry;
511 bool found;
512 MinimalTuple key;
513
514 key = NULL; /* flag to reference inputslot */
515
516 if (isnew)
517 {
518 entry = tuplehash_insert_hash(hashtable->hashtab, key, hash, &found);
519
520 if (found)
521 {
522 /* found pre-existing entry */
523 *isnew = false;
524 }
525 else
526 {
527 /* created new entry */
528 *isnew = true;
529 /* zero caller data */
530 entry->additional = NULL;
531 MemoryContextSwitchTo(hashtable->tablecxt);
532 /* Copy the first tuple into the table context */
533 entry->firstTuple = ExecCopySlotMinimalTuple(slot);
534 }
535 }
536 else
537 {
538 entry = tuplehash_lookup_hash(hashtable->hashtab, key, hash);
539 }
540
541 return entry;
542}
543
544/*
545 * See whether two tuples (presumably of the same hash value) match

Callers 2

LookupTupleHashEntryFunction · 0.85
LookupTupleHashEntryHashFunction · 0.85

Calls 2

MemoryContextSwitchToFunction · 0.85
ExecCopySlotMinimalTupleFunction · 0.85

Tested by

no test coverage detected