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

Function build_join_rel_hash

src/backend/optimizer/util/relnode.c:532–566  ·  view source on GitHub ↗

* build_join_rel_hash * Construct the auxiliary hash table for join relations. */

Source from the content-addressed store, hash-verified

530 * Construct the auxiliary hash table for join relations.
531 */
532static void
533build_join_rel_hash(PlannerInfo *root)
534{
535 HTAB *hashtab;
536 HASHCTL hash_ctl;
537 ListCell *l;
538
539 /* Create the hash table */
540 hash_ctl.keysize = sizeof(Relids);
541 hash_ctl.entrysize = sizeof(JoinHashEntry);
542 hash_ctl.hash = bitmap_hash;
543 hash_ctl.match = bitmap_match;
544 hash_ctl.hcxt = CurrentMemoryContext;
545 hashtab = hash_create("JoinRelHashTable",
546 256L,
547 &hash_ctl,
548 HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
549
550 /* Insert all the already-existing joinrels */
551 foreach(l, root->join_rel_list)
552 {
553 RelOptInfo *rel = (RelOptInfo *) lfirst(l);
554 JoinHashEntry *hentry;
555 bool found;
556
557 hentry = (JoinHashEntry *) hash_search(hashtab,
558 &(rel->relids),
559 HASH_ENTER,
560 &found);
561 Assert(!found);
562 hentry->join_rel = rel;
563 }
564
565 root->join_rel_hash = hashtab;
566}
567
568/*
569 * find_join_rel

Callers 1

find_join_relFunction · 0.85

Calls 3

hash_createFunction · 0.85
hash_searchFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected