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.

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

Referenced by ExecEndNode().

228 {
230 
231  ExecFreeExprContext(&node->ss.ps);
232 
233  /* clean up tuple table */
235 
236  outerPlan = outerPlanState(node);
237  ExecEndNode(outerPlan);
238 }
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:425
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:537
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1333
void ExecFreeExprContext(PlanState *planstate)
Definition: execUtils.c:614
ScanState ss
Definition: execnodes.h:2009
PlanState ps
Definition: execnodes.h:1330
#define outerPlanState(node)
Definition: execnodes.h:1033
#define outerPlan(node)
Definition: plannodes.h:170

◆ 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(), ExecGetResultSlotOps(), ExecGetResultType(), ExecGroup(), ExecInitNode(), ExecInitQual(), ExecInitResultTupleSlotTL(), PlanState::ExecProcNode, execTuplesMatchPrepare(), GroupState::grp_done, Group::grpColIdx, Group::grpCollations, Group::grpOperators, makeNode, Group::numCols, outerPlan, outerPlanState, Group::plan, PlanState::plan, ScanState::ps, Plan::qual, PlanState::qual, GroupState::ss, PlanState::state, and TTSOpsVirtual.

Referenced by ExecInitNode().

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 }
List * qual
Definition: plannodes.h:141
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition: execUtils.c:463
const TupleTableSlotOps TTSOpsVirtual
Definition: execTuples.c:83
EState * state
Definition: execnodes.h:941
bool grp_done
Definition: execnodes.h:2011
ExprState * ExecInitQual(List *qual, PlanState *parent)
Definition: execExpr.c:207
ScanState ss
Definition: execnodes.h:2009
PlanState ps
Definition: execnodes.h:1330
ExprState * eqfunction
Definition: execnodes.h:2010
#define EXEC_FLAG_BACKWARD
Definition: executor.h:58
#define outerPlanState(node)
Definition: execnodes.h:1033
Oid * grpCollations
Definition: plannodes.h:785
void ExecAssignProjectionInfo(PlanState *planstate, TupleDesc inputDesc)
Definition: execUtils.c:499
int numCols
Definition: plannodes.h:782
#define outerPlan(node)
Definition: plannodes.h:170
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:945
Plan * plan
Definition: execnodes.h:939
#define makeNode(_type_)
Definition: nodes.h:573
#define Assert(condition)
Definition: c.h:739
ExprState * execTuplesMatchPrepare(TupleDesc desc, int numCols, const AttrNumber *keyColIdx, const Oid *eqOperators, const Oid *collations, PlanState *parent)
Definition: execGrouping.c:59
#define EXEC_FLAG_MARK
Definition: executor.h:59
Plan plan
Definition: plannodes.h:781
void ExecAssignExprContext(EState *estate, PlanState *planstate)
Definition: execUtils.c:444
void ExecInitResultTupleSlotTL(PlanState *planstate, const TupleTableSlotOps *tts_ops)
Definition: execTuples.c:1769
TupleDesc ExecGetResultType(PlanState *planstate)
Definition: execUtils.c:454
ExprState * qual
Definition: execnodes.h:960
static TupleTableSlot * ExecGroup(PlanState *pstate)
Definition: nodeGroup.c:37
AttrNumber * grpColIdx
Definition: plannodes.h:783
void ExecCreateScanSlotFromOuterPlan(EState *estate, ScanState *scanstate, const TupleTableSlotOps *tts_ops)
Definition: execUtils.c:646
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:138
Oid * grpOperators
Definition: plannodes.h:784

◆ ExecReScanGroup()

void ExecReScanGroup ( GroupState node)

Definition at line 241 of file nodeGroup.c.

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

Referenced by ExecReScan().

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)
254  ExecReScan(outerPlan);
255 }
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
Definition: tuptable.h:425
void ExecReScan(PlanState *node)
Definition: execAmi.c:75
TupleTableSlot * ss_ScanTupleSlot
Definition: execnodes.h:1333
bool grp_done
Definition: execnodes.h:2011
ScanState ss
Definition: execnodes.h:2009
#define outerPlanState(node)
Definition: execnodes.h:1033
Bitmapset * chgParam
Definition: execnodes.h:971
#define outerPlan(node)
Definition: plannodes.h:170