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

Function CatalogCacheComputeTupleHashValue

src/backend/utils/cache/catcache.c:319–367  ·  view source on GitHub ↗

* CatalogCacheComputeTupleHashValue * * Compute the hash value associated with a given tuple to be cached */

Source from the content-addressed store, hash-verified

317 * Compute the hash value associated with a given tuple to be cached
318 */
319static uint32
320CatalogCacheComputeTupleHashValue(CatCache *cache, int nkeys, HeapTuple tuple)
321{
322 Datum v1 = 0,
323 v2 = 0,
324 v3 = 0,
325 v4 = 0;
326 bool isNull = false;
327 int *cc_keyno = cache->cc_keyno;
328 TupleDesc cc_tupdesc = cache->cc_tupdesc;
329
330 /* Now extract key fields from tuple, insert into scankey */
331 switch (nkeys)
332 {
333 case 4:
334 v4 = fastgetattr(tuple,
335 cc_keyno[3],
336 cc_tupdesc,
337 &isNull);
338 Assert(!isNull);
339 /* FALLTHROUGH */
340 case 3:
341 v3 = fastgetattr(tuple,
342 cc_keyno[2],
343 cc_tupdesc,
344 &isNull);
345 Assert(!isNull);
346 /* FALLTHROUGH */
347 case 2:
348 v2 = fastgetattr(tuple,
349 cc_keyno[1],
350 cc_tupdesc,
351 &isNull);
352 Assert(!isNull);
353 /* FALLTHROUGH */
354 case 1:
355 v1 = fastgetattr(tuple,
356 cc_keyno[0],
357 cc_tupdesc,
358 &isNull);
359 Assert(!isNull);
360 break;
361 default:
362 elog(FATAL, "wrong number of hash keys: %d", nkeys);
363 break;
364 }
365
366 return CatalogCacheComputeHashValue(cache, nkeys, v1, v2, v3, v4);
367}
368
369/*
370 * CatalogCacheCompareTuple

Callers 2

SearchCatCacheListFunction · 0.85

Calls 2

fastgetattrFunction · 0.50

Tested by

no test coverage detected