----------------- * ExecInitGroup * * Creates the run-time information for the group node produced by the * planner and initializes its outer subtree * ----------------- */
| 159 | * ----------------- |
| 160 | */ |
| 161 | GroupState * |
| 162 | ExecInitGroup(Group *node, EState *estate, int eflags) |
| 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 | */ |
| 198 | ExecInitResultTupleSlotTL(&grpstate->ss.ps, &TTSOpsVirtual); |
| 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 = |
| 211 | execTuplesMatchPrepare(ExecGetResultType(outerPlanState(grpstate)), |
| 212 | node->numCols, |
| 213 | node->grpColIdx, |
| 214 | node->grpOperators, |
| 215 | node->grpCollations, |
| 216 | &grpstate->ss.ps); |
| 217 | |
| 218 | return grpstate; |
no test coverage detected