* Evaluate the hash keys, and compute the target segment ID for the new row. */
| 38 | * Evaluate the hash keys, and compute the target segment ID for the new row. |
| 39 | */ |
| 40 | static uint32 |
| 41 | evalHashKey(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 */ |
| 72 | static void |
no test coverage detected