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

Function ExecInitSubqueryScan

src/backend/executor/nodeSubqueryscan.c:98–161  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitSubqueryScan * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

96 * ----------------------------------------------------------------
97 */
98SubqueryScanState *
99ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
100{
101 SubqueryScanState *subquerystate;
102
103 /* check for unsupported flags */
104 Assert(!(eflags & EXEC_FLAG_MARK));
105
106 /* SubqueryScan should not have any "normal" children */
107 Assert(outerPlan(node) == NULL);
108 Assert(innerPlan(node) == NULL);
109
110 /*
111 * create state structure
112 */
113 subquerystate = makeNode(SubqueryScanState);
114 subquerystate->ss.ps.plan = (Plan *) node;
115 subquerystate->ss.ps.state = estate;
116 subquerystate->ss.ps.ExecProcNode = ExecSubqueryScan;
117
118 /*
119 * Miscellaneous initialization
120 *
121 * create expression context for node
122 */
123 ExecAssignExprContext(estate, &subquerystate->ss.ps);
124
125 /*
126 * initialize subquery
127 */
128 subquerystate->subplan = ExecInitNode(node->subplan, estate, eflags);
129
130 /*
131 * Initialize scan slot and type (needed by ExecAssignScanProjectionInfo)
132 */
133 ExecInitScanTupleSlot(estate, &subquerystate->ss,
134 ExecGetResultType(subquerystate->subplan),
135 ExecGetResultSlotOps(subquerystate->subplan, NULL));
136
137 /*
138 * The slot used as the scantuple isn't the slot above (outside of EPQ),
139 * but the one from the node below.
140 */
141 subquerystate->ss.ps.scanopsset = true;
142 subquerystate->ss.ps.scanops = ExecGetResultSlotOps(subquerystate->subplan,
143 &subquerystate->ss.ps.scanopsfixed);
144 subquerystate->ss.ps.resultopsset = true;
145 subquerystate->ss.ps.resultops = subquerystate->ss.ps.scanops;
146 subquerystate->ss.ps.resultopsfixed = subquerystate->ss.ps.scanopsfixed;
147
148 /*
149 * Initialize result type and projection.
150 */
151 ExecInitResultTypeTL(&subquerystate->ss.ps);
152 ExecAssignScanProjectionInfo(&subquerystate->ss);
153
154 /*
155 * initialize child expressions

Callers 1

ExecInitNodeFunction · 0.85

Calls 8

ExecAssignExprContextFunction · 0.85
ExecInitNodeFunction · 0.85
ExecInitScanTupleSlotFunction · 0.85
ExecGetResultTypeFunction · 0.85
ExecGetResultSlotOpsFunction · 0.85
ExecInitResultTypeTLFunction · 0.85
ExecInitQualFunction · 0.85

Tested by

no test coverage detected