MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecInitAgg

Function ExecInitAgg

src/backend/executor/nodeAgg.c:3502–4327  ·  view source on GitHub ↗

----------------- * ExecInitAgg * * Creates the run-time information for the agg node produced by the * planner and initializes its outer subtree. * * ----------------- */

Source from the content-addressed store, hash-verified

3500 * -----------------
3501 */
3502AggState *
3503ExecInitAgg(Agg *node, EState *estate, int eflags)
3504{
3505 AggState *aggstate;
3506 AggStatePerAgg peraggs;
3507 AggStatePerTrans pertransstates;
3508 AggStatePerGroup *pergroups;
3509 Plan *outerPlan;
3510 ExprContext *econtext;
3511 TupleDesc scanDesc;
3512 int max_aggno;
3513 int max_transno;
3514 int numaggrefs;
3515 int numaggs;
3516 int numtrans;
3517 int phase;
3518 int phaseidx;
3519 ListCell *l;
3520 Bitmapset *all_grouped_cols = NULL;
3521 int numGroupingSets = 1;
3522 int numPhases;
3523 int numHashes;
3524 int i = 0;
3525 int j = 0;
3526 bool use_hashing = (node->aggstrategy == AGG_HASHED ||
3527 node->aggstrategy == AGG_MIXED);
3528 int numgsets = 0;
3529
3530 /* check for unsupported flags */
3531 Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
3532
3533 /*
3534 * create state structure
3535 */
3536 aggstate = makeNode(AggState);
3537 aggstate->ss.ps.plan = (Plan *) node;
3538 aggstate->ss.ps.state = estate;
3539 aggstate->ss.ps.ExecProcNode = ExecAgg;
3540
3541 aggstate->aggs = NIL;
3542 aggstate->numaggs = 0;
3543 aggstate->numtrans = 0;
3544 aggstate->aggstrategy = node->aggstrategy;
3545 aggstate->aggsplit = node->aggsplit;
3546 aggstate->maxsets = 0;
3547 aggstate->projected_set = -1;
3548 aggstate->current_set = 0;
3549 aggstate->peragg = NULL;
3550 aggstate->pertrans = NULL;
3551 aggstate->curperagg = NULL;
3552 aggstate->curpertrans = NULL;
3553 aggstate->input_done = false;
3554 aggstate->agg_done = false;
3555 aggstate->pergroups = NULL;
3556 aggstate->grp_firstTuple = NULL;
3557 aggstate->sort_in = NULL;
3558 aggstate->sort_out = NULL;
3559 aggstate->aggs_used = NULL;

Callers 1

ExecInitNodeFunction · 0.85

Calls 15

list_lengthFunction · 0.85
ExecAssignExprContextFunction · 0.85
CreateWorkExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
ExecGetResultSlotOpsFunction · 0.85
ExecInitExtraTupleSlotFunction · 0.85
ExecAssignProjectionInfoFunction · 0.85
makeStringInfoFunction · 0.85
ExecInitQualFunction · 0.85
bms_add_memberFunction · 0.85

Tested by

no test coverage detected