* Returns true if tuple matches hash filter. */
| 174 | * Returns true if tuple matches hash filter. |
| 175 | */ |
| 176 | static bool |
| 177 | TupleMatchesHashFilter(ResultState *node, TupleTableSlot *resultSlot) |
| 178 | { |
| 179 | Result *resultNode = (Result *)node->ps.plan; |
| 180 | bool res = true; |
| 181 | |
| 182 | Assert(resultNode); |
| 183 | Assert(!TupIsNull(resultSlot)); |
| 184 | |
| 185 | if (node->hashFilter) |
| 186 | { |
| 187 | int i; |
| 188 | |
| 189 | cdbhashinit(node->hashFilter); |
| 190 | for (i = 0; i < resultNode->numHashFilterCols; i++) |
| 191 | { |
| 192 | int attnum = resultNode->hashFilterColIdx[i]; |
| 193 | Datum hAttr; |
| 194 | bool isnull; |
| 195 | |
| 196 | hAttr = slot_getattr(resultSlot, attnum, &isnull); |
| 197 | |
| 198 | cdbhash(node->hashFilter, i + 1, hAttr, isnull); |
| 199 | } |
| 200 | |
| 201 | int targetSeg = cdbhashreduce(node->hashFilter); |
| 202 | |
| 203 | res = (targetSeg == GpIdentity.segindex); |
| 204 | } |
| 205 | |
| 206 | return res; |
| 207 | } |
| 208 | |
| 209 | /* ---------------------------------------------------------------- |
| 210 | * ExecResultMarkPos |
no test coverage detected