---------------------------------------------------------------- * Scan Support * ---------------------------------------------------------------- */ ---------------------------------------------------------------- * SeqNext * * This is a workhorse for ExecSeqScan * ---------------------------------------------------------------- */
| 55 | * ---------------------------------------------------------------- |
| 56 | */ |
| 57 | static TupleTableSlot * |
| 58 | SeqNext(SeqScanState *node) |
| 59 | { |
| 60 | TableScanDesc scandesc; |
| 61 | EState *estate; |
| 62 | ScanDirection direction; |
| 63 | TupleTableSlot *slot; |
| 64 | |
| 65 | /* |
| 66 | * get information from the estate and scan state |
| 67 | */ |
| 68 | scandesc = node->ss.ss_currentScanDesc; |
| 69 | estate = node->ss.ps.state; |
| 70 | direction = estate->es_direction; |
| 71 | slot = node->ss.ss_ScanTupleSlot; |
| 72 | |
| 73 | if (scandesc == NULL) |
| 74 | { |
| 75 | int nkeys = 0; |
| 76 | ScanKey keys = NULL; |
| 77 | |
| 78 | /* |
| 79 | * Just when gp_enable_runtime_filter_pushdown enabled and |
| 80 | * node->filter_in_seqscan is false means scankey need to be pushed to |
| 81 | * AM. |
| 82 | */ |
| 83 | if (gp_enable_runtime_filter_pushdown && node->filter_in_seqscan && node->filters && |
| 84 | (table_scan_flags(node->ss.ss_currentRelation) & |
| 85 | (SCAN_SUPPORT_RUNTIME_FILTER))) |
| 86 | { |
| 87 | // pushdown runtime filter to AM |
| 88 | keys = ScanKeyListToArray(node->filters, &nkeys); |
| 89 | } |
| 90 | |
| 91 | /* |
| 92 | * We reach here if the scan is not parallel, or if we're serially |
| 93 | * executing a scan that was planned to be parallel. |
| 94 | */ |
| 95 | scandesc = table_beginscan_es(node->ss.ss_currentRelation, |
| 96 | estate->es_snapshot, |
| 97 | nkeys, keys, |
| 98 | NULL, |
| 99 | &node->ss.ps); |
| 100 | node->ss.ss_currentScanDesc = scandesc; |
| 101 | } |
| 102 | |
| 103 | /* |
| 104 | * get the next tuple from the table |
| 105 | */ |
| 106 | if (node->filter_in_seqscan && node->filters) |
| 107 | { |
| 108 | while (table_scan_getnextslot(scandesc, direction, slot)) |
| 109 | { |
| 110 | // TODO: later pushdown bloom filter to AM |
| 111 | if (!PassByBloomFilter(&node->ss.ps, node->filters, slot)) |
| 112 | continue; |
| 113 | |
| 114 | return slot; |
nothing calls this directly
no test coverage detected