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

Function create_functionscan_path

src/backend/optimizer/util/pathnode.c:3078–3254  ·  view source on GitHub ↗

* create_functionscan_path * Creates a path corresponding to a sequential scan of a function, * returning the pathnode. */

Source from the content-addressed store, hash-verified

3076 * returning the pathnode.
3077 */
3078Path *
3079create_functionscan_path(PlannerInfo *root, RelOptInfo *rel,
3080 RangeTblEntry *rte,
3081 List *pathkeys, Relids required_outer)
3082{
3083 Path *pathnode = makeNode(Path);
3084 ListCell *lc;
3085
3086 pathnode->pathtype = T_FunctionScan;
3087 pathnode->parent = rel;
3088 pathnode->pathtarget = rel->reltarget;
3089 pathnode->param_info = get_baserel_parampathinfo(root, rel,
3090 required_outer);
3091 pathnode->parallel_aware = false;
3092 pathnode->parallel_safe = rel->consider_parallel;
3093 pathnode->parallel_workers = 0;
3094 pathnode->pathkeys = pathkeys;
3095
3096 /*
3097 * Decide where to execute the FunctionScan.
3098 */
3099 if (Gp_role == GP_ROLE_DISPATCH)
3100 {
3101 char exec_location = PROEXECLOCATION_ANY;
3102 bool contain_mutables = false;
3103 bool contain_outer_params = false;
3104
3105 /*
3106 * If the function desires to run on segments, mark randomly-distributed.
3107 * If expression contains mutable functions, evaluate it on entry db.
3108 * Otherwise let it be evaluated in the same slice as its parent operator.
3109 */
3110 Assert(rte->rtekind == RTE_FUNCTION);
3111
3112 foreach (lc, rel->baserestrictinfo)
3113 {
3114 RestrictInfo *rinfo = (RestrictInfo *) lfirst(lc);
3115
3116 if (rinfo->contain_outer_query_references)
3117 {
3118 contain_outer_params = true;
3119 break;
3120 }
3121 }
3122
3123 foreach (lc, rte->functions)
3124 {
3125 RangeTblFunction *rtfunc = (RangeTblFunction *) lfirst(lc);
3126
3127 if (rtfunc->funcexpr && IsA(rtfunc->funcexpr, FuncExpr))
3128 {
3129 FuncExpr *funcexpr = (FuncExpr *) rtfunc->funcexpr;
3130 char this_exec_location;
3131
3132 this_exec_location = func_exec_location(funcexpr->funcid);
3133
3134 switch (this_exec_location)
3135 {

Callers 1

set_function_pathlistFunction · 0.85

Calls 9

func_exec_locationFunction · 0.85
contains_outer_paramsFunction · 0.85
getgpsegmentCountFunction · 0.85
cost_functionscanFunction · 0.85
foreachFunction · 0.50
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected