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

Function ExecScanFetch

src/backend/executor/execScan.c:35–138  ·  view source on GitHub ↗

* ExecScanFetch -- check interrupts & fetch next potential tuple * * This routine is concerned with substituting a test tuple if we are * inside an EvalPlanQual recheck. If we aren't, just execute * the access method's next-tuple routine. */

Source from the content-addressed store, hash-verified

33 * the access method's next-tuple routine.
34 */
35static inline TupleTableSlot *
36ExecScanFetch(ScanState *node,
37 ExecScanAccessMtd accessMtd,
38 ExecScanRecheckMtd recheckMtd)
39{
40 EState *estate = node->ps.state;
41
42 CHECK_FOR_INTERRUPTS();
43
44 if (QueryFinishPending)
45 return NULL;
46
47 if (estate->es_epq_active != NULL)
48 {
49 EPQState *epqstate = estate->es_epq_active;
50
51 /*
52 * We are inside an EvalPlanQual recheck. Return the test tuple if
53 * one is available, after rechecking any access-method-specific
54 * conditions.
55 */
56 Index scanrelid = ((Scan *) node->ps.plan)->scanrelid;
57
58 if (scanrelid == 0)
59 {
60 /*
61 * This is a ForeignScan or CustomScan which has pushed down a
62 * join to the remote side. The recheck method is responsible not
63 * only for rechecking the scan/join quals but also for storing
64 * the correct tuple in the slot.
65 */
66
67 TupleTableSlot *slot = node->ss_ScanTupleSlot;
68
69 if (!(*recheckMtd) (node, slot))
70 ExecClearTuple(slot); /* would not be returned by scan */
71 return slot;
72 }
73 else if (epqstate->relsubs_done[scanrelid - 1])
74 {
75 /*
76 * Return empty slot, as we already performed an EPQ substitution
77 * for this relation.
78 */
79
80 TupleTableSlot *slot = node->ss_ScanTupleSlot;
81
82 /* Return empty slot, as we already returned a tuple */
83 return ExecClearTuple(slot);
84 }
85 else if (epqstate->relsubs_slot[scanrelid - 1] != NULL)
86 {
87 /*
88 * Return replacement tuple provided by the EPQ caller.
89 */
90
91 TupleTableSlot *slot = epqstate->relsubs_slot[scanrelid - 1];
92

Callers 1

ExecScanFunction · 0.85

Calls 2

ExecClearTupleFunction · 0.85
EvalPlanQualFetchRowMarkFunction · 0.85

Tested by

no test coverage detected