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

Function create_foreignscan_path

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

* create_foreignscan_path * Creates a path corresponding to a scan of a foreign base table, * returning the pathnode. * * This function is never called from core Postgres; rather, it's expected * to be called by the GetForeignPaths function of a foreign data wrapper. * We make the FDW supply all fields of the path, since we do not have any way * to calculate them in core. However, ther

Source from the content-addressed store, hash-verified

3645 * the pathtarget (rel->reltarget), so we let a NULL for "target" select that.
3646 */
3647ForeignPath *
3648create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
3649 PathTarget *target,
3650 double rows, Cost startup_cost, Cost total_cost,
3651 List *pathkeys,
3652 Relids required_outer,
3653 Path *fdw_outerpath,
3654 List *fdw_private)
3655{
3656 ForeignPath *pathnode = makeNode(ForeignPath);
3657
3658 /* Historically some FDWs were confused about when to use this */
3659 Assert(IS_SIMPLE_REL(rel));
3660
3661 pathnode->path.pathtype = T_ForeignScan;
3662 pathnode->path.parent = rel;
3663 pathnode->path.pathtarget = target ? target : rel->reltarget;
3664 pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
3665 required_outer);
3666 pathnode->path.parallel_aware = false;
3667 pathnode->path.parallel_safe = rel->consider_parallel;
3668 pathnode->path.parallel_workers = 0;
3669 pathnode->path.rows = rows;
3670 pathnode->path.startup_cost = startup_cost;
3671 pathnode->path.total_cost = total_cost;
3672 pathnode->path.pathkeys = pathkeys;
3673 if (Gp_role == GP_ROLE_DISPATCH)
3674 {
3675 make_cdbpathlocus_for_foreign_relations(root, rel, pathnode);
3676 }
3677 else
3678 {
3679 /* make entry locus for utility role */
3680 CdbPathLocus_MakeEntry(&(pathnode->path.locus));
3681 }
3682 pathnode->fdw_outerpath = fdw_outerpath;
3683 pathnode->fdw_private = fdw_private;
3684
3685 return pathnode;
3686}
3687
3688/*
3689 * create_foreign_join_path