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

Function evalHashKey

src/backend/executor/nodeSplitUpdate.c:40–69  ·  view source on GitHub ↗

* Evaluate the hash keys, and compute the target segment ID for the new row. */

Source from the content-addressed store, hash-verified

38 * Evaluate the hash keys, and compute the target segment ID for the new row.
39 */
40static uint32
41evalHashKey(SplitUpdateState *node, Datum *values, bool *isnulls)
42{
43 SplitUpdate *plannode = (SplitUpdate *) node->ps.plan;
44 ExprContext *econtext = node->ps.ps_ExprContext;
45 MemoryContext oldContext;
46 unsigned int target_seg;
47 CdbHash *h = node->cdbhash;
48
49 ResetExprContext(econtext);
50
51 oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
52
53 cdbhashinit(h);
54
55 for (int i = 0; i < plannode->numHashAttrs; i++)
56 {
57 AttrNumber keyattno = plannode->hashAttnos[i];
58
59 /*
60 * Compute the hash function
61 */
62 cdbhash(h, i + 1, values[keyattno - 1], isnulls[keyattno - 1]);
63 }
64 target_seg = cdbhashreduce(h);
65
66 MemoryContextSwitchTo(oldContext);
67
68 return target_seg;
69}
70
71/* Split TupleTableSlot into a DELETE and INSERT TupleTableSlot */
72static void

Callers 1

SplitTupleTableSlotFunction · 0.70

Calls 4

MemoryContextSwitchToFunction · 0.85
cdbhashinitFunction · 0.85
cdbhashFunction · 0.85
cdbhashreduceFunction · 0.85

Tested by

no test coverage detected