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

Function EvalPlanQualEnd

src/backend/executor/execMain.c:4096–4149  ·  view source on GitHub ↗

* EvalPlanQualEnd -- shut down at termination of parent plan state node, * or if we are done with the current EPQ child. * * This is a cut-down version of ExecutorEnd(); basically we want to do most * of the normal cleanup, but *not* close result relations (which we are * just sharing from the outer query). We do, however, have to close any * result and trigger target relations that got ope

Source from the content-addressed store, hash-verified

4094 * case...)
4095 */
4096void
4097EvalPlanQualEnd(EPQState *epqstate)
4098{
4099 EState *estate = epqstate->recheckestate;
4100 Index rtsize;
4101 MemoryContext oldcontext;
4102 ListCell *l;
4103
4104 rtsize = epqstate->parentestate->es_range_table_size;
4105
4106 /*
4107 * We may have a tuple table, even if EPQ wasn't started, because we allow
4108 * use of EvalPlanQualSlot() without calling EvalPlanQualBegin().
4109 */
4110 if (epqstate->tuple_table != NIL)
4111 {
4112 memset(epqstate->relsubs_slot, 0,
4113 rtsize * sizeof(TupleTableSlot *));
4114 ExecResetTupleTable(epqstate->tuple_table, true);
4115 epqstate->tuple_table = NIL;
4116 }
4117
4118 /* EPQ wasn't started, nothing further to do */
4119 if (estate == NULL)
4120 return;
4121
4122 oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
4123
4124 ExecEndNode(epqstate->recheckplanstate);
4125
4126 foreach(l, estate->es_subplanstates)
4127 {
4128 PlanState *subplanstate = (PlanState *) lfirst(l);
4129
4130 ExecEndNode(subplanstate);
4131 }
4132
4133 /* throw away the per-estate tuple table, some node may have used it */
4134 ExecResetTupleTable(estate->es_tupleTable, false);
4135
4136 /* Close any result and trigger target relations attached to this EState */
4137 ExecCloseResultRelations(estate);
4138
4139 MemoryContextSwitchTo(oldcontext);
4140
4141 FreeExecutorState(estate);
4142
4143 /* Mark EPQState idle */
4144 epqstate->origslot = NULL;
4145 epqstate->recheckestate = NULL;
4146 epqstate->recheckplanstate = NULL;
4147 epqstate->relsubs_rowmark = NULL;
4148 epqstate->relsubs_done = NULL;
4149}
4150
4151/* Use the given attribute map to convert an attribute number in the
4152 * base relation to an attribute number in the other relation. Forgive

Callers 7

EvalPlanQualSetPlanFunction · 0.85
ExecEndModifyTableFunction · 0.85
ExecLockRowsFunction · 0.85
ExecEndLockRowsFunction · 0.85

Calls 6

ExecResetTupleTableFunction · 0.85
MemoryContextSwitchToFunction · 0.85
ExecEndNodeFunction · 0.85
ExecCloseResultRelationsFunction · 0.85
FreeExecutorStateFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected