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

Function find_oper_cache_entry

src/backend/parser/parse_oper.c:993–1025  ·  view source on GitHub ↗

* find_oper_cache_entry * * Look for a cache entry matching the given key. If found, return the * contained operator OID, else return InvalidOid. */

Source from the content-addressed store, hash-verified

991 * contained operator OID, else return InvalidOid.
992 */
993static Oid
994find_oper_cache_entry(OprCacheKey *key)
995{
996 OprCacheEntry *oprentry;
997
998 if (OprCacheHash == NULL)
999 {
1000 /* First time through: initialize the hash table */
1001 HASHCTL ctl;
1002
1003 ctl.keysize = sizeof(OprCacheKey);
1004 ctl.entrysize = sizeof(OprCacheEntry);
1005 OprCacheHash = hash_create("Operator lookup cache", 256,
1006 &ctl, HASH_ELEM | HASH_BLOBS);
1007
1008 /* Arrange to flush cache on pg_operator and pg_cast changes */
1009 CacheRegisterSyscacheCallback(OPERNAMENSP,
1010 InvalidateOprCacheCallBack,
1011 (Datum) 0);
1012 CacheRegisterSyscacheCallback(CASTSOURCETARGET,
1013 InvalidateOprCacheCallBack,
1014 (Datum) 0);
1015 }
1016
1017 /* Look for an existing entry */
1018 oprentry = (OprCacheEntry *) hash_search(OprCacheHash,
1019 (void *) key,
1020 HASH_FIND, NULL);
1021 if (oprentry == NULL)
1022 return InvalidOid;
1023
1024 return oprentry->opr_oid;
1025}
1026
1027/*
1028 * make_oper_cache_entry

Callers 2

operFunction · 0.85
left_operFunction · 0.85

Calls 3

hash_createFunction · 0.85
hash_searchFunction · 0.85

Tested by

no test coverage detected