| 175 | |
| 176 | |
| 177 | TupleTableSlot * |
| 178 | ExecDynamicSeqScan(PlanState *pstate) |
| 179 | { |
| 180 | DynamicSeqScanState *node = castNode(DynamicSeqScanState, pstate); |
| 181 | TupleTableSlot *slot = NULL; |
| 182 | |
| 183 | DynamicSeqScan *plan = (DynamicSeqScan *) node->ss.ps.plan; |
| 184 | node->as_valid_subplans = NULL; |
| 185 | if (NULL != plan->join_prune_paramids && !node->did_pruning) |
| 186 | { |
| 187 | node->did_pruning = true; |
| 188 | node->as_valid_subplans = |
| 189 | ExecFindMatchingSubPlans(node->as_prune_state, |
| 190 | node->ss.ps.state, |
| 191 | list_length(plan->partOids), |
| 192 | plan->join_prune_paramids); |
| 193 | |
| 194 | int i = 0; |
| 195 | int partOidIdx = -1; |
| 196 | List *newPartOids = NIL; |
| 197 | ListCell *lc; |
| 198 | for(i = 0; i < bms_num_members(node->as_valid_subplans); i++) |
| 199 | { |
| 200 | partOidIdx = bms_next_member(node->as_valid_subplans, partOidIdx); |
| 201 | newPartOids = lappend_oid(newPartOids, node->partOids[partOidIdx]); |
| 202 | } |
| 203 | |
| 204 | node->partOids = palloc(sizeof(Oid) * list_length(newPartOids)); |
| 205 | foreach_with_count(lc, newPartOids, i) |
| 206 | node->partOids[i] = lfirst_oid(lc); |
| 207 | node->nOids = list_length(newPartOids); |
| 208 | } |
| 209 | |
| 210 | /* |
| 211 | * Scan the table to find next tuple to return. If the current table |
| 212 | * is finished, close it and open the next table for scan. |
| 213 | */ |
| 214 | for (;;) |
| 215 | { |
| 216 | if (!node->seqScanState) |
| 217 | { |
| 218 | /* No partition open. Open the next one, if any. */ |
| 219 | if (!initNextTableToScan(node)) |
| 220 | break; |
| 221 | } |
| 222 | |
| 223 | slot = ExecProcNode(&node->seqScanState->ss.ps); |
| 224 | |
| 225 | if (!TupIsNull(slot)) |
| 226 | { |
| 227 | if (gp_enable_runtime_filter_pushdown |
| 228 | && !pstate->state->useMppParallelMode |
| 229 | && node->filters) |
| 230 | { |
| 231 | if (!PassByBloomFilter(&node->ss.ps, node->filters, slot)) |
| 232 | continue; |
| 233 | } |
| 234 | break; |
nothing calls this directly
no test coverage detected