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

Function FunctionNext_guts

src/backend/executor/nodeFunctionscan.c:70–312  ·  view source on GitHub ↗

---------------------------------------------------------------- * Scan Support * ---------------------------------------------------------------- */ ---------------------------------------------------------------- * FunctionNext * * This is a workhorse for ExecFunctionScan * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

68 * ----------------------------------------------------------------
69 */
70static TupleTableSlot *
71FunctionNext_guts(FunctionScanState *node)
72{
73 EState *estate;
74 ScanDirection direction;
75 TupleTableSlot *scanslot;
76 bool alldone;
77 int64 oldpos;
78 int funcno;
79 int att;
80
81 /*
82 * get information from the estate and scan state
83 */
84 estate = node->ss.ps.state;
85 direction = estate->es_direction;
86 scanslot = node->ss.ss_ScanTupleSlot;
87
88 /*
89 * FunctionNext read tuple from tuplestore instead
90 * of executing the real function.
91 * Tuplestore is filled by the FunctionScan's initplan.
92 */
93 if(node->resultInTupleStore)
94 {
95 bool gotOK = false;
96 bool forward = true;
97
98 /*
99 * Setup tuplestore reader on first call.
100 *
101 * The tuplestore should have been created by preprocess_initplans()
102 * already, we just read it here.
103 */
104 if (!node->ts_state)
105 {
106 char rwfile_prefix[100];
107 function_scan_create_bufname_prefix(rwfile_prefix, sizeof(rwfile_prefix), node->initplanId);
108
109 node->ts_state = tuplestore_open_shared(get_shareinput_fileset(),
110 rwfile_prefix);
111 }
112
113 gotOK = tuplestore_gettupleslot(node->ts_state, forward, false,
114 scanslot);
115
116 if(!gotOK)
117 {
118 return NULL;
119 }
120 return scanslot;
121 }
122
123 if (node->simple)
124 {
125 /*
126 * Fast path for the trivial case: the function return type and scan
127 * result type are the same, so we fetch the function result straight

Callers 1

FunctionNextFunction · 0.85

Calls 13

tuplestore_open_sharedFunction · 0.85
get_shareinput_filesetFunction · 0.85
tuplestore_gettupleslotFunction · 0.85
PlanStateOperatorMemKBFunction · 0.85
tuplestore_rescanFunction · 0.85
ExecClearTupleFunction · 0.85
slot_getallattrsFunction · 0.85
slot_getattrFunction · 0.85
Int64GetDatumFastFunction · 0.85

Tested by

no test coverage detected