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

Function ExecReScanAppend

src/backend/executor/nodeAppend.c:421–487  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void
422ExecReScanAppend(AppendState *node)
423{
424 int nasyncplans = node->as_nasyncplans;
425 int i;
426
427 /*
428 * If any PARAM_EXEC Params used in pruning expressions have changed, then
429 * we'd better unset the valid subplans so that they are reselected for
430 * the new parameter values.
431 */
432 if (node->as_prune_state &&
433 bms_overlap(node->ps.chgParam,
434 node->as_prune_state->execparamids))
435 {
436 bms_free(node->as_valid_subplans);
437 node->as_valid_subplans = NULL;
438 if (nasyncplans > 0)
439 {
440 bms_free(node->as_valid_asyncplans);
441 node->as_valid_asyncplans = NULL;
442 }
443 }
444
445 for (i = 0; i < node->as_nplans; i++)
446 {
447 PlanState *subnode = node->appendplans[i];
448
449 /*
450 * ExecReScan doesn't know about my subplans, so I have to do
451 * changed-parameter signaling myself.
452 */
453 if (node->ps.chgParam != NULL)
454 UpdateChangedParamSet(subnode, node->ps.chgParam);
455
456 /*
457 * If chgParam of subnode is not null then plan will be re-scanned by
458 * first ExecProcNode or by first ExecAsyncRequest.
459 */
460 if (subnode->chgParam == NULL)
461 ExecReScan(subnode);
462 }
463
464 /* Reset async state */
465 if (nasyncplans > 0)
466 {
467 i = -1;
468 while ((i = bms_next_member(node->as_asyncplans, i)) >= 0)
469 {
470 AsyncRequest *areq = node->as_asyncrequests[i];
471
472 areq->callback_pending = false;
473 areq->request_complete = false;
474 areq->result = NULL;
475 }
476
477 node->as_nasyncresults = 0;
478 node->as_nasyncremain = 0;

Callers 1

ExecReScanFunction · 0.85

Calls 5

bms_overlapFunction · 0.85
bms_freeFunction · 0.85
UpdateChangedParamSetFunction · 0.85
ExecReScanFunction · 0.85
bms_next_memberFunction · 0.85

Tested by

no test coverage detected