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

Function ExecInitFunctionScan

src/backend/executor/nodeFunctionscan.c:360–637  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInitFunctionScan * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

358 * ----------------------------------------------------------------
359 */
360FunctionScanState *
361ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags)
362{
363 FunctionScanState *scanstate;
364 int nfuncs = list_length(node->functions);
365 TupleDesc scan_tupdesc;
366 int i,
367 natts;
368 ListCell *lc;
369
370 /* check for unsupported flags */
371 Assert(!(eflags & EXEC_FLAG_MARK));
372
373 /*
374 * FunctionScan should not have any children.
375 */
376 Assert(outerPlan(node) == NULL);
377 Assert(innerPlan(node) == NULL);
378
379 /*
380 * create new ScanState for node
381 */
382 scanstate = makeNode(FunctionScanState);
383 scanstate->ss.ps.plan = (Plan *) node;
384 scanstate->ss.ps.state = estate;
385 scanstate->ss.ps.ExecProcNode = ExecFunctionScan;
386 scanstate->eflags = eflags;
387 scanstate->resultInTupleStore = node->resultInTupleStore;
388 scanstate->initplanId = node->initplanId;
389 scanstate->ts_state = NULL;
390
391 /*
392 * are we adding an ordinality column?
393 */
394 scanstate->ordinality = node->funcordinality;
395
396 scanstate->nfuncs = nfuncs;
397 if (nfuncs == 1 && !node->funcordinality)
398 scanstate->simple = true;
399 else
400 scanstate->simple = false;
401
402 /*
403 * Ordinal 0 represents the "before the first row" position.
404 *
405 * We need to track ordinal position even when not adding an ordinality
406 * column to the result, in order to handle backwards scanning properly
407 * with multiple functions with different result sizes. (We can't position
408 * any individual function's tuplestore any more than 1 place beyond its
409 * end, so when scanning backwards, we need to know when to start
410 * including the function in the scan again.)
411 */
412 scanstate->ordinal = 0;
413
414 /*
415 * Miscellaneous initialization
416 *
417 * create expression context for node

Callers 1

ExecInitNodeFunction · 0.85

Calls 15

list_lengthFunction · 0.85
ExecAssignExprContextFunction · 0.85
get_expr_result_typeFunction · 0.85
CreateTupleDescCopyFunction · 0.85
CreateTemplateTupleDescFunction · 0.85
TupleDescInitEntryFunction · 0.85
exprCollationFunction · 0.85
BuildDescFromListsFunction · 0.85
BlessTupleDescFunction · 0.85
ExecInitExtraTupleSlotFunction · 0.85

Tested by

no test coverage detected