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

Function ExecInitSampleScan

src/backend/executor/nodeSamplescan.c:95–173  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitSampleScan * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

93 * ----------------------------------------------------------------
94 */
95SampleScanState *
96ExecInitSampleScan(SampleScan *node, EState *estate, int eflags)
97{
98 SampleScanState *scanstate;
99 TableSampleClause *tsc = node->tablesample;
100 TsmRoutine *tsm;
101
102 Assert(outerPlan(node) == NULL);
103 Assert(innerPlan(node) == NULL);
104
105 /*
106 * create state structure
107 */
108 scanstate = makeNode(SampleScanState);
109 scanstate->ss.ps.plan = (Plan *) node;
110 scanstate->ss.ps.state = estate;
111 scanstate->ss.ps.ExecProcNode = ExecSampleScan;
112
113 /*
114 * Miscellaneous initialization
115 *
116 * create expression context for node
117 */
118 ExecAssignExprContext(estate, &scanstate->ss.ps);
119
120 /*
121 * open the scan relation
122 */
123 scanstate->ss.ss_currentRelation =
124 ExecOpenScanRelation(estate,
125 node->scan.scanrelid,
126 eflags);
127
128 /* we won't set up the HeapScanDesc till later */
129 scanstate->ss.ss_currentScanDesc = NULL;
130
131 /* and create slot with appropriate rowtype */
132 ExecInitScanTupleSlot(estate, &scanstate->ss,
133 RelationGetDescr(scanstate->ss.ss_currentRelation),
134 table_slot_callbacks(scanstate->ss.ss_currentRelation));
135
136 /*
137 * Initialize result type and projection.
138 */
139 ExecInitResultTypeTL(&scanstate->ss.ps);
140 ExecAssignScanProjectionInfo(&scanstate->ss);
141
142 /*
143 * initialize child expressions
144 */
145 scanstate->ss.ps.qual =
146 ExecInitQual(node->scan.plan.qual, (PlanState *) scanstate);
147
148 scanstate->args = ExecInitExprList(tsc->args, (PlanState *) scanstate);
149 scanstate->repeatable =
150 ExecInitExpr(tsc->repeatable, (PlanState *) scanstate);
151
152 /*

Callers 1

ExecInitNodeFunction · 0.85

Calls 11

ExecAssignExprContextFunction · 0.85
ExecOpenScanRelationFunction · 0.85
ExecInitScanTupleSlotFunction · 0.85
table_slot_callbacksFunction · 0.85
ExecInitResultTypeTLFunction · 0.85
ExecInitQualFunction · 0.85
ExecInitExprListFunction · 0.85
ExecInitExprFunction · 0.85
randomFunction · 0.85
GetTsmRoutineFunction · 0.85

Tested by

no test coverage detected