PostgreSQL Source Code  git master
nodeGroup.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeGroup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GroupStateExecInitGroup (Group *node, EState *estate, int eflags)
 
void ExecEndGroup (GroupState *node)
 
void ExecReScanGroup (GroupState *node)
 

Function Documentation

◆ ExecEndGroup()

void ExecEndGroup ( GroupState node)

Definition at line 227 of file nodeGroup.c.

228 {
230 
231  ExecFreeExprContext(&node->ss.ps);
232 
233  /* clean up tuple table */
235 
236  outerPlan = outerPlanState(node);
238 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:557
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:658
#define outerPlanState(node)
Definition: execnodes.h:1133
#define outerPlan(node)
Definition: plannodes.h:183
ScanState ss
Definition: execnodes.h:2332
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1477
PlanState ps
Definition: execnodes.h:1474
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:432

References ExecClearTuple(), ExecEndNode(), ExecFreeExprContext(), outerPlan, outerPlanState, ScanState::ps, GroupState::ss, and ScanState::ss_ScanTupleSlot.

Referenced by ExecEndNode().

◆ ExecInitGroup()

GroupState* ExecInitGroup ( Group node,
EState estate,
int  eflags 
)

Definition at line 162 of file nodeGroup.c.

163 {
164  GroupState *grpstate;
165  const TupleTableSlotOps *tts_ops;
166 
167  /* check for unsupported flags */
168  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
169 
170  /*
171  * create state structure
172  */
173  grpstate = makeNode(GroupState);
174  grpstate->ss.ps.plan = (Plan *) node;
175  grpstate->ss.ps.state = estate;
176  grpstate->ss.ps.ExecProcNode = ExecGroup;
177  grpstate->grp_done = false;
178 
179  /*
180  * create expression context
181  */
182  ExecAssignExprContext(estate, &grpstate->ss.ps);
183 
184  /*
185  * initialize child nodes
186  */
187  outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate, eflags);
188 
189  /*
190  * Initialize scan slot and type.
191  */
192  tts_ops = ExecGetResultSlotOps(outerPlanState(&grpstate->ss), NULL);
193  ExecCreateScanSlotFromOuterPlan(estate, &grpstate->ss, tts_ops);
194 
195  /*
196  * Initialize result slot, type and projection.
197  */
199  ExecAssignProjectionInfo(&grpstate->ss.ps, NULL);
200 
201  /*
202  * initialize child expressions
203  */
204  grpstate->ss.ps.qual =
205  ExecInitQual(node->plan.qual, (PlanState *) grpstate);
206 
207  /*
208  * Precompute fmgr lookup data for inner loop
209  */
210  grpstate->eqfunction =
212  node->numCols,
213  node->grpColIdx,
214  node->grpOperators,
215  node->grpCollations,
216  &grpstate->ss.ps);
217 
218  return grpstate;
219 }
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:214
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, const AttrNumber *keyColIdx, const Oid *eqOperators, const Oid *collations, PlanState *parent)
Definition: execGrouping.c:59
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:142
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:83
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1800
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:498
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition: execUtils.c:507
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate, const TupleTableSlotOps *tts_ops)
Definition: execUtils.c:690
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:488
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:543
#define EXEC_FLAG_BACKWARD
Definition: executor.h:68
#define EXEC_FLAG_MARK
Definition: executor.h:69
Assert(fmt[strlen(fmt) - 1] !='\n')
static TupleTableSlot * ExecGroup(PlanState *pstate)
Definition: nodeGroup.c:37
#define makeNode(_type_)
Definition: nodes.h:176
ExprState * eqfunction
Definition: execnodes.h:2333
bool grp_done
Definition: execnodes.h:2334
int numCols
Definition: plannodes.h:970
Plan plan
Definition: plannodes.h:967
ExprState * qual
Definition: execnodes.h:1058
Plan * plan
Definition: execnodes.h:1037
EState * state
Definition: execnodes.h:1039
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1043
List * qual
Definition: plannodes.h:154

References Assert(), GroupState::eqfunction, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecCreateScanSlotFromOuterPlan(), ExecGetResultSlotOps(), ExecGetResultType(), ExecGroup(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlotTL(), PlanState::ExecProcNode, execTuplesMatchPrepare(), GroupState::grp_done, makeNode, Group::numCols, outerPlan, outerPlanState, PlanState::plan, Group::plan, ScanState::ps, PlanState::qual, Plan::qual, GroupState::ss, PlanState::state, and TTSOpsVirtual.

Referenced by ExecInitNode().

◆ ExecReScanGroup()

void ExecReScanGroup ( GroupState node)

Definition at line 241 of file nodeGroup.c.

242 {
244 
245  node->grp_done = false;
246  /* must clear first tuple */
248 
249  /*
250  * if chgParam of subnode is not null then plan will be re-scanned by
251  * first ExecProcNode.
252  */
253  if (outerPlan->chgParam == NULL)
255 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:78

References ExecClearTuple(), ExecReScan(), GroupState::grp_done, outerPlan, outerPlanState, GroupState::ss, and ScanState::ss_ScanTupleSlot.

Referenced by ExecReScan().