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

Function ExecInitSetOp

src/backend/executor/nodeSetOp.c:480–573  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitSetOp * * This initializes the setop node state structures and * the node's subplan. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

478 * ----------------------------------------------------------------
479 */
480SetOpState *
481ExecInitSetOp(SetOp *node, EState *estate, int eflags)
482{
483 SetOpState *setopstate;
484 TupleDesc outerDesc;
485
486 /* check for unsupported flags */
487 Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
488
489 /*
490 * create state structure
491 */
492 setopstate = makeNode(SetOpState);
493 setopstate->ps.plan = (Plan *) node;
494 setopstate->ps.state = estate;
495 setopstate->ps.ExecProcNode = ExecSetOp;
496
497 setopstate->eqfuncoids = NULL;
498 setopstate->hashfunctions = NULL;
499 setopstate->setop_done = false;
500 setopstate->numOutput = 0;
501 setopstate->pergroup = NULL;
502 setopstate->grp_firstTuple = NULL;
503 setopstate->hashtable = NULL;
504 setopstate->tableContext = NULL;
505
506 /*
507 * create expression context
508 */
509 ExecAssignExprContext(estate, &setopstate->ps);
510
511 /*
512 * If hashing, we also need a longer-lived context to store the hash
513 * table. The table can't just be kept in the per-query context because
514 * we want to be able to throw it away in ExecReScanSetOp.
515 */
516 if (node->strategy == SETOP_HASHED)
517 setopstate->tableContext =
518 AllocSetContextCreate(CurrentMemoryContext,
519 "SetOp hash table",
520 ALLOCSET_DEFAULT_SIZES);
521
522 /*
523 * initialize child nodes
524 *
525 * If we are hashing then the child plan does not need to handle REWIND
526 * efficiently; see ExecReScanSetOp.
527 */
528 if (node->strategy == SETOP_HASHED)
529 eflags &= ~EXEC_FLAG_REWIND;
530 outerPlanState(setopstate) = ExecInitNode(outerPlan(node), estate, eflags);
531 outerDesc = ExecGetResultType(outerPlanState(setopstate));
532
533 /*
534 * Initialize result slot and type. Setop nodes do no projections, so
535 * initialize projection info for this node appropriately.
536 */
537 ExecInitResultTupleSlotTL(&setopstate->ps,

Callers 1

ExecInitNodeFunction · 0.85

Calls 8

ExecAssignExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
ExecGetResultTypeFunction · 0.85
execTuplesHashPrepareFunction · 0.85
execTuplesMatchPrepareFunction · 0.85
build_hash_tableFunction · 0.70
palloc0Function · 0.50

Tested by

no test coverage detected