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

Function ExecInitUnique

src/backend/executor/nodeUnique.c:115–160  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitUnique * * This initializes the unique node state structures and * the node's subplan. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

113 * ----------------------------------------------------------------
114 */
115UniqueState *
116ExecInitUnique(Unique *node, EState *estate, int eflags)
117{
118 UniqueState *uniquestate;
119
120 /* check for unsupported flags */
121 Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
122
123 /*
124 * create state structure
125 */
126 uniquestate = makeNode(UniqueState);
127 uniquestate->ps.plan = (Plan *) node;
128 uniquestate->ps.state = estate;
129 uniquestate->ps.ExecProcNode = ExecUnique;
130
131 /*
132 * create expression context
133 */
134 ExecAssignExprContext(estate, &uniquestate->ps);
135
136 /*
137 * then initialize outer plan
138 */
139 outerPlanState(uniquestate) = ExecInitNode(outerPlan(node), estate, eflags);
140
141 /*
142 * Initialize result slot and type. Unique nodes do no projections, so
143 * initialize projection info for this node appropriately.
144 */
145 ExecInitResultTupleSlotTL(&uniquestate->ps, &TTSOpsMinimalTuple);
146 uniquestate->ps.ps_ProjInfo = NULL;
147
148 /*
149 * Precompute fmgr lookup data for inner loop
150 */
151 uniquestate->eqfunction =
152 execTuplesMatchPrepare(ExecGetResultType(outerPlanState(uniquestate)),
153 node->numCols,
154 node->uniqColIdx,
155 node->uniqOperators,
156 node->uniqCollations,
157 &uniquestate->ps);
158
159 return uniquestate;
160}
161
162/* ----------------------------------------------------------------
163 * ExecEndUnique

Callers 1

ExecInitNodeFunction · 0.85

Calls 5

ExecAssignExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
execTuplesMatchPrepareFunction · 0.85
ExecGetResultTypeFunction · 0.85

Tested by

no test coverage detected