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 224 of file nodeGroup.c.

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

Referenced by ExecEndNode().

225 {
227 
228  ExecFreeExprContext(&node->ss.ps);
229 
230  /* clean up tuple table */
232 
233  outerPlan = outerPlanState(node);
234  ExecEndNode(outerPlan);
235 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:539
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:475
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1127
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:561
ScanState ss
Definition: execnodes.h:1801
PlanState ps
Definition: execnodes.h:1124
#define outerPlanState(node)
Definition: execnodes.h:914
#define outerPlan(node)
Definition: plannodes.h:174

◆ ExecInitGroup()

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

Definition at line 162 of file nodeGroup.c.

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

Referenced by ExecInitNode().

163 {
164  GroupState *grpstate;
165 
166  /* check for unsupported flags */
167  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
168 
169  /*
170  * create state structure
171  */
172  grpstate = makeNode(GroupState);
173  grpstate->ss.ps.plan = (Plan *) node;
174  grpstate->ss.ps.state = estate;
175  grpstate->ss.ps.ExecProcNode = ExecGroup;
176  grpstate->grp_done = false;
177 
178  /*
179  * create expression context
180  */
181  ExecAssignExprContext(estate, &grpstate->ss.ps);
182 
183  /*
184  * initialize child nodes
185  */
186  outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate, eflags);
187 
188  /*
189  * Initialize scan slot and type.
190  */
191  ExecCreateScanSlotFromOuterPlan(estate, &grpstate->ss);
192 
193  /*
194  * Initialize result slot, type and projection.
195  */
196  ExecInitResultTupleSlotTL(estate, &grpstate->ss.ps);
197  ExecAssignProjectionInfo(&grpstate->ss.ps, NULL);
198 
199  /*
200  * initialize child expressions
201  */
202  grpstate->ss.ps.qual =
203  ExecInitQual(node->plan.qual, (PlanState *) grpstate);
204 
205  /*
206  * Precompute fmgr lookup data for inner loop
207  */
208  grpstate->eqfunction =
210  node->numCols,
211  node->grpColIdx,
212  node->grpOperators,
213  &grpstate->ss.ps);
214 
215  return grpstate;
216 }
List * qual
Definition: plannodes.h:145
EState * state
Definition: execnodes.h:870
bool grp_done
Definition: execnodes.h:1803
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:204
ScanState ss
Definition: execnodes.h:1801
PlanState ps
Definition: execnodes.h:1124
ExprState * eqfunction
Definition: execnodes.h:1802
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate)
Definition: execUtils.c:593
#define EXEC_FLAG_BACKWARD
Definition: executor.h:61
#define outerPlanState(node)
Definition: execnodes.h:914
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:453
int numCols
Definition: plannodes.h:763
#define outerPlan(node)
Definition: plannodes.h:174
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:874
void ExecInitResultTupleSlotTL(EState *estate, PlanState *planstate)
Definition: execTuples.c:870
Plan * plan
Definition: execnodes.h:868
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, AttrNumber *keyColIdx, Oid *eqOperators, PlanState *parent)
Definition: execGrouping.c:60
#define makeNode(_type_)
Definition: nodes.h:561
#define Assert(condition)
Definition: c.h:688
#define EXEC_FLAG_MARK
Definition: executor.h:62
Plan plan
Definition: plannodes.h:762
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:425
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:435
ExprState * qual
Definition: execnodes.h:886
static TupleTableSlot * ExecGroup(PlanState *pstate)
Definition: nodeGroup.c:37
AttrNumber * grpColIdx
Definition: plannodes.h:764
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
Oid * grpOperators
Definition: plannodes.h:765

◆ ExecReScanGroup()

void ExecReScanGroup ( GroupState node)

Definition at line 238 of file nodeGroup.c.

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

Referenced by ExecReScan().

239 {
241 
242  node->grp_done = false;
243  /* must clear first tuple */
245 
246  /*
247  * if chgParam of subnode is not null then plan will be re-scanned by
248  * first ExecProcNode.
249  */
250  if (outerPlan->chgParam == NULL)
251  ExecReScan(outerPlan);
252 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:475
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1127
bool grp_done
Definition: execnodes.h:1803
ScanState ss
Definition: execnodes.h:1801
#define outerPlanState(node)
Definition: execnodes.h:914
Bitmapset * chgParam
Definition: execnodes.h:896
#define outerPlan(node)
Definition: plannodes.h:174