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

Function ExecInitFunctionResultSet

src/backend/executor/execSRF.c:447–485  ·  view source on GitHub ↗

* Prepare targetlist SRF function call for execution. * * This is used by nodeProjectSet.c. */

Source from the content-addressed store, hash-verified

445 * This is used by nodeProjectSet.c.
446 */
447SetExprState *
448ExecInitFunctionResultSet(Expr *expr,
449 ExprContext *econtext, PlanState *parent)
450{
451 SetExprState *state = makeNode(SetExprState);
452
453 state->funcReturnsSet = true;
454 state->expr = expr;
455 state->func.fn_oid = InvalidOid;
456
457 /*
458 * Initialize metadata. The expression node could be either a FuncExpr or
459 * an OpExpr.
460 */
461 if (IsA(expr, FuncExpr))
462 {
463 FuncExpr *func = (FuncExpr *) expr;
464
465 state->args = ExecInitExprList(func->args, parent);
466 init_sexpr(func->funcid, func->inputcollid, expr, state, parent,
467 econtext->ecxt_per_query_memory, true, true);
468 }
469 else if (IsA(expr, OpExpr))
470 {
471 OpExpr *op = (OpExpr *) expr;
472
473 state->args = ExecInitExprList(op->args, parent);
474 init_sexpr(op->opfuncid, op->inputcollid, expr, state, parent,
475 econtext->ecxt_per_query_memory, true, true);
476 }
477 else
478 elog(ERROR, "unrecognized node type: %d",
479 (int) nodeTag(expr));
480
481 /* shouldn't get here unless the selected function returns set */
482 Assert(state->func.fn_retset);
483
484 return state;
485}
486
487/*
488 * ExecMakeFunctionResultSet

Callers 1

ExecInitProjectSetFunction · 0.85

Calls 2

ExecInitExprListFunction · 0.85
init_sexprFunction · 0.85

Tested by

no test coverage detected