* ExecParallelScanHashBucket * scan a hash bucket for matches to the current outer tuple * * The current outer tuple must be stored in econtext->ecxt_outertuple. * * On success, the inner tuple is stored into hjstate->hj_CurTuple and * econtext->ecxt_innertuple, using hjstate->hj_HashTupleSlot as the slot * for the latter. */
| 2317 | * for the latter. |
| 2318 | */ |
| 2319 | bool |
| 2320 | ExecParallelScanHashBucket(HashState *hashState, HashJoinState *hjstate, |
| 2321 | ExprContext *econtext) |
| 2322 | { |
| 2323 | /* |
| 2324 | * Greenplum specific behavior. |
| 2325 | * Using hashqualclauses to support hash join on 'IS NOT DISTINCT FROM' |
| 2326 | * as well as '='. |
| 2327 | */ |
| 2328 | ExprState *hjclauses = hjstate->hashqualclauses; |
| 2329 | HashJoinTable hashtable = hjstate->hj_HashTable; |
| 2330 | HashJoinTuple hashTuple = hjstate->hj_CurTuple; |
| 2331 | uint32 hashvalue = hjstate->hj_CurHashValue; |
| 2332 | |
| 2333 | /* |
| 2334 | * hj_CurTuple is the address of the tuple last returned from the current |
| 2335 | * bucket, or NULL if it's time to start scanning a new bucket. |
| 2336 | */ |
| 2337 | if (hashTuple != NULL) |
| 2338 | hashTuple = ExecParallelHashNextTuple(hashtable, hashTuple); |
| 2339 | else |
| 2340 | hashTuple = ExecParallelHashFirstTuple(hashtable, |
| 2341 | hjstate->hj_CurBucketNo); |
| 2342 | |
| 2343 | while (hashTuple != NULL) |
| 2344 | { |
| 2345 | if (hashTuple->hashvalue == hashvalue) |
| 2346 | { |
| 2347 | TupleTableSlot *inntuple; |
| 2348 | |
| 2349 | /* insert hashtable's tuple into exec slot so ExecQual sees it */ |
| 2350 | inntuple = ExecStoreMinimalTuple(HJTUPLE_MINTUPLE(hashTuple), |
| 2351 | hjstate->hj_HashTupleSlot, |
| 2352 | false); /* do not pfree */ |
| 2353 | econtext->ecxt_innertuple = inntuple; |
| 2354 | |
| 2355 | if (ExecQualAndReset(hjclauses, econtext)) |
| 2356 | { |
| 2357 | hjstate->hj_CurTuple = hashTuple; |
| 2358 | return true; |
| 2359 | } |
| 2360 | } |
| 2361 | |
| 2362 | hashTuple = ExecParallelHashNextTuple(hashtable, hashTuple); |
| 2363 | } |
| 2364 | |
| 2365 | /* |
| 2366 | * no match |
| 2367 | */ |
| 2368 | return false; |
| 2369 | } |
| 2370 | |
| 2371 | /* |
| 2372 | * ExecPrepHashTableForUnmatched |
no test coverage detected