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

Function ExecInitLimit

src/backend/executor/nodeLimit.c:471–551  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitLimit * * This initializes the limit node state structures and * the node's subplan. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

469 * ----------------------------------------------------------------
470 */
471LimitState *
472ExecInitLimit(Limit *node, EState *estate, int eflags)
473{
474 LimitState *limitstate;
475 Plan *outerPlan;
476
477 /* check for unsupported flags */
478 Assert(!(eflags & EXEC_FLAG_MARK));
479
480 /*
481 * create state structure
482 */
483 limitstate = makeNode(LimitState);
484 limitstate->ps.plan = (Plan *) node;
485 limitstate->ps.state = estate;
486 limitstate->ps.ExecProcNode = ExecLimit;
487
488 limitstate->lstate = LIMIT_INITIAL;
489
490 /*
491 * Miscellaneous initialization
492 *
493 * Limit nodes never call ExecQual or ExecProject, but they need an
494 * exprcontext anyway to evaluate the limit/offset parameters in.
495 */
496 ExecAssignExprContext(estate, &limitstate->ps);
497
498 /*
499 * initialize outer plan
500 */
501 outerPlan = outerPlan(node);
502 outerPlanState(limitstate) = ExecInitNode(outerPlan, estate, eflags);
503
504 /*
505 * initialize child expressions
506 */
507 limitstate->limitOffset = ExecInitExpr((Expr *) node->limitOffset,
508 (PlanState *) limitstate);
509 limitstate->limitCount = ExecInitExpr((Expr *) node->limitCount,
510 (PlanState *) limitstate);
511 limitstate->limitOption = node->limitOption;
512
513 /*
514 * Initialize result type.
515 */
516 ExecInitResultTypeTL(&limitstate->ps);
517
518 limitstate->ps.resultopsset = true;
519 limitstate->ps.resultops = ExecGetResultSlotOps(outerPlanState(limitstate),
520 &limitstate->ps.resultopsfixed);
521
522 /*
523 * limit nodes do no projections, so initialize projection info for this
524 * node appropriately
525 */
526 limitstate->ps.ps_ProjInfo = NULL;
527
528 limitstate->expect_rescan = ((eflags & EXEC_FLAG_REWIND) != 0);

Callers 1

ExecInitNodeFunction · 0.85

Calls 8

ExecAssignExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
ExecInitExprFunction · 0.85
ExecInitResultTypeTLFunction · 0.85
ExecGetResultSlotOpsFunction · 0.85
ExecGetResultTypeFunction · 0.85
ExecInitExtraTupleSlotFunction · 0.85
execTuplesMatchPrepareFunction · 0.85

Tested by

no test coverage detected