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

Function ExecParallelHashJoinOuterGetTuple

src/backend/executor/nodeHashjoin.c:1180–1245  ·  view source on GitHub ↗

* ExecHashJoinOuterGetTuple variant for the parallel case. */

Source from the content-addressed store, hash-verified

1178 * ExecHashJoinOuterGetTuple variant for the parallel case.
1179 */
1180static TupleTableSlot *
1181ExecParallelHashJoinOuterGetTuple(PlanState *outerNode,
1182 HashJoinState *hjstate,
1183 uint32 *hashvalue)
1184{
1185 HashJoinTable hashtable = hjstate->hj_HashTable;
1186 int curbatch = hashtable->curbatch;
1187 TupleTableSlot *slot;
1188 HashState *hashState = (HashState *) innerPlanState(hjstate);
1189
1190 /*
1191 * In the Parallel Hash case we only run the outer plan directly for
1192 * single-batch hash joins. Otherwise we have to go to batch files, even
1193 * for batch 0.
1194 */
1195 if (curbatch == 0 && hashtable->nbatch == 1)
1196 {
1197 slot = ExecProcNode(outerNode);
1198
1199 while (!TupIsNull(slot))
1200 {
1201 ExprContext *econtext = hjstate->js.ps.ps_ExprContext;
1202 bool hashkeys_null = false;
1203 bool keep_nulls;
1204
1205 keep_nulls = HJ_FILL_OUTER(hjstate) ||
1206 hjstate->hj_nonequijoin;
1207
1208 econtext->ecxt_outertuple = slot;
1209 if (ExecHashGetHashValue(hashState,
1210 hashtable, econtext,
1211 hjstate->hj_OuterHashKeys,
1212 true, /* outer tuple */
1213 keep_nulls,
1214 hashvalue,
1215 &hashkeys_null))
1216 return slot;
1217
1218 /*
1219 * That tuple couldn't match because of a NULL, so discard it and
1220 * continue with the next one.
1221 */
1222 slot = ExecProcNode(outerNode);
1223 }
1224 }
1225 else if (curbatch < hashtable->nbatch)
1226 {
1227 MinimalTuple tuple;
1228
1229 tuple = sts_parallel_scan_next(hashtable->batches[curbatch].outer_tuples,
1230 hashvalue);
1231 if (tuple != NULL)
1232 {
1233 ExecForceStoreMinimalTuple(tuple,
1234 hjstate->hj_OuterTupleSlot,
1235 false);
1236 slot = hjstate->hj_OuterTupleSlot;
1237 return slot;

Callers 1

ExecHashJoinImplFunction · 0.85

Calls 5

ExecProcNodeFunction · 0.85
ExecHashGetHashValueFunction · 0.85
sts_parallel_scan_nextFunction · 0.85
ExecClearTupleFunction · 0.85

Tested by

no test coverage detected