---------------------------------------------------------------- * ExecInitSampleScan * ---------------------------------------------------------------- */
| 93 | * ---------------------------------------------------------------- |
| 94 | */ |
| 95 | SampleScanState * |
| 96 | ExecInitSampleScan(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 | /* |
no test coverage detected