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

Function create_tablefunction_path

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

* create_tablefunction_path * Creates a path corresponding to a sequential scan of a table function, * returning the pathnode. * * NB: This is a GPDB specific thing, to support this syntax: * * SELECT * FROM multiset_5( TABLE( SELECT * from example) ) order by a, b; * * Despite the similar name, this is completely different from the upstream * create_tablefuncscan_path() function be

Source from the content-addressed store, hash-verified

3267 * XMLTABLE and similar functions.
3268 */
3269TableFunctionScanPath *
3270create_tablefunction_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
3271 List *pathkeys, Relids required_outer)
3272{
3273 TableFunctionScanPath *pathnode = makeNode(TableFunctionScanPath);
3274
3275 /* Setup the basics of the TableFunction path */
3276 pathnode->path.pathtype = T_TableFunctionScan;
3277 pathnode->path.parent = rel;
3278 pathnode->path.pathtarget = rel->reltarget;
3279 pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
3280 required_outer);
3281 pathnode->path.parallel_aware = false;
3282 pathnode->path.parallel_safe = rel->consider_parallel &&
3283 subpath->parallel_safe;
3284 pathnode->path.parallel_workers = subpath->parallel_workers;
3285 pathnode->path.pathkeys = NIL; /* no way to specify output ordering */
3286 pathnode->subpath = subpath;
3287
3288 pathnode->path.motionHazard = true; /* better safe than sorry */
3289 pathnode->path.barrierHazard = true; /* better safe than sorry */
3290 pathnode->path.rescannable = false; /* better safe than sorry */
3291
3292 /*
3293 * Inherit the locus of the input subquery's path. This is necessary to handle the
3294 * case of a General locus, e.g. if all the data has been concentrated to a
3295 * single segment then the output will all be on that segment, otherwise the
3296 * output must be declared as randomly distributed because we do not know
3297 * what relationship, if any, there is between the input data and the output
3298 * data.
3299 */
3300 pathnode->path.locus = subpath->locus;
3301
3302 /* Mark the output as random if the input is partitioned */
3303 if (CdbPathLocus_IsPartitioned(pathnode->path.locus))
3304 CdbPathLocus_MakeStrewn(&pathnode->path.locus,
3305 CdbPathLocus_NumSegments(pathnode->path.locus), 0);
3306 pathnode->path.sameslice_relids = NULL;
3307
3308 cost_tablefunction(pathnode, root, rel, pathnode->path.param_info);
3309
3310 return pathnode;
3311}
3312
3313/*
3314 * create_tablefuncscan_path

Callers 1

Calls 2

cost_tablefunctionFunction · 0.85

Tested by

no test coverage detected