* execTuplesHashPrepare * Look up the equality and hashing functions needed for a TupleHashTable. * * This is similar to execTuplesMatchPrepare, but we also need to find the * hash functions associated with the equality operators. *eqFunctions and * *hashFunctions receive the palloc'd result arrays. * * Note: we expect that the given operators are not cross-type comparisons. */
| 95 | * Note: we expect that the given operators are not cross-type comparisons. |
| 96 | */ |
| 97 | void |
| 98 | execTuplesHashPrepare(int numCols, |
| 99 | const Oid *eqOperators, |
| 100 | Oid **eqFuncOids, |
| 101 | FmgrInfo **hashFunctions) |
| 102 | { |
| 103 | int i; |
| 104 | |
| 105 | *eqFuncOids = (Oid *) palloc(numCols * sizeof(Oid)); |
| 106 | *hashFunctions = (FmgrInfo *) palloc(numCols * sizeof(FmgrInfo)); |
| 107 | |
| 108 | for (i = 0; i < numCols; i++) |
| 109 | { |
| 110 | Oid eq_opr = eqOperators[i]; |
| 111 | Oid eq_function; |
| 112 | Oid left_hash_function; |
| 113 | Oid right_hash_function; |
| 114 | |
| 115 | eq_function = get_opcode(eq_opr); |
| 116 | if (!get_op_hash_functions(eq_opr, |
| 117 | &left_hash_function, &right_hash_function)) |
| 118 | elog(ERROR, "could not find hash function for hash operator %u", |
| 119 | eq_opr); |
| 120 | /* We're not supporting cross-type cases here */ |
| 121 | Assert(left_hash_function == right_hash_function); |
| 122 | (*eqFuncOids)[i] = eq_function; |
| 123 | fmgr_info(right_hash_function, &(*hashFunctions)[i]); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /***************************************************************************** |
no test coverage detected