PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

void ExecEndGroup ( GroupState node)

Definition at line 231 of file nodeGroup.c.

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

Referenced by ExecEndNode().

232 {
234 
235  ExecFreeExprContext(&node->ss.ps);
236 
237  /* clean up tuple table */
239 
240  outerPlan = outerPlanState(node);
241  ExecEndNode(outerPlan);
242 }
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:523
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1103
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:521
ScanState ss
Definition: execnodes.h:1769
PlanState ps
Definition: execnodes.h:1100
#define outerPlanState(node)
Definition: execnodes.h:893
#define outerPlan(node)
Definition: plannodes.h:174
GroupState* ExecInitGroup ( Group node,
EState estate,
int  eflags 
)

Definition at line 166 of file nodeGroup.c.

References Assert, GroupState::eqfunctions, EXEC_FLAG_BACKWARD, EXEC_FLAG_MARK, ExecAssignExprContext(), ExecAssignProjectionInfo(), ExecAssignResultTypeFromTL(), ExecAssignScanTypeFromOuterPlan(), ExecGroup(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlot(), ExecInitScanTupleSlot(), PlanState::ExecProcNode, execTuplesMatchPrepare(), FALSE, GroupState::grp_done, 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().

167 {
168  GroupState *grpstate;
169 
170  /* check for unsupported flags */
171  Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
172 
173  /*
174  * create state structure
175  */
176  grpstate = makeNode(GroupState);
177  grpstate->ss.ps.plan = (Plan *) node;
178  grpstate->ss.ps.state = estate;
179  grpstate->ss.ps.ExecProcNode = ExecGroup;
180  grpstate->grp_done = FALSE;
181 
182  /*
183  * create expression context
184  */
185  ExecAssignExprContext(estate, &grpstate->ss.ps);
186 
187  /*
188  * tuple table initialization
189  */
190  ExecInitScanTupleSlot(estate, &grpstate->ss);
191  ExecInitResultTupleSlot(estate, &grpstate->ss.ps);
192 
193  /*
194  * initialize child expressions
195  */
196  grpstate->ss.ps.qual =
197  ExecInitQual(node->plan.qual, (PlanState *) grpstate);
198 
199  /*
200  * initialize child nodes
201  */
202  outerPlanState(grpstate) = ExecInitNode(outerPlan(node), estate, eflags);
203 
204  /*
205  * initialize tuple type.
206  */
208 
209  /*
210  * Initialize result tuple type and projection info.
211  */
212  ExecAssignResultTypeFromTL(&grpstate->ss.ps);
213  ExecAssignProjectionInfo(&grpstate->ss.ps, NULL);
214 
215  /*
216  * Precompute fmgr lookup data for inner loop
217  */
218  grpstate->eqfunctions =
220  node->grpOperators);
221 
222  return grpstate;
223 }
List * qual
Definition: plannodes.h:145
void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
Definition: execTuples.c:842
EState * state
Definition: execnodes.h:849
bool grp_done
Definition: execnodes.h:1771
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:160
void ExecAssignResultTypeFromTL(PlanState *planstate)
Definition: execUtils.c:445
ScanState ss
Definition: execnodes.h:1769
PlanState ps
Definition: execnodes.h:1100
#define FALSE
Definition: c.h:219
void ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
Definition: execTuples.c:832
#define EXEC_FLAG_BACKWARD
Definition: executor.h:60
#define outerPlanState(node)
Definition: execnodes.h:893
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:492
int numCols
Definition: plannodes.h:761
#define outerPlan(node)
Definition: plannodes.h:174
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:853
Plan * plan
Definition: execnodes.h:847
#define makeNode(_type_)
Definition: nodes.h:557
#define Assert(condition)
Definition: c.h:664
#define EXEC_FLAG_MARK
Definition: executor.h:61
Plan plan
Definition: plannodes.h:760
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:423
ExprState * qual
Definition: execnodes.h:865
static TupleTableSlot * ExecGroup(PlanState *pstate)
Definition: nodeGroup.c:36
void ExecAssignScanTypeFromOuterPlan(ScanState *scanstate)
Definition: execUtils.c:557
FmgrInfo * eqfunctions
Definition: execnodes.h:1770
FmgrInfo * execTuplesMatchPrepare(int numCols, Oid *eqOperators)
Definition: execGrouping.c:204
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:139
Oid * grpOperators
Definition: plannodes.h:763
void ExecReScanGroup ( GroupState node)

Definition at line 245 of file nodeGroup.c.

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

Referenced by ExecReScan().

246 {
248 
249  node->grp_done = FALSE;
250  /* must clear first tuple */
252 
253  /*
254  * if chgParam of subnode is not null then plan will be re-scanned by
255  * first ExecProcNode.
256  */
257  if (outerPlan->chgParam == NULL)
258  ExecReScan(outerPlan);
259 }
void ExecReScan(PlanState *node)
Definition: execAmi.c:76
TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: execTuples.c:439
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1103
bool grp_done
Definition: execnodes.h:1771
ScanState ss
Definition: execnodes.h:1769
#define FALSE
Definition: c.h:219
#define outerPlanState(node)
Definition: execnodes.h:893
Bitmapset * chgParam
Definition: execnodes.h:875
#define outerPlan(node)
Definition: plannodes.h:174