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

Function create_nestloop_path

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

* create_nestloop_path * Creates a pathnode corresponding to a nestloop join between two * relations. * * 'joinrel' is the join relation. * 'jointype' is the type of join required * 'workspace' is the result from initial_cost_nestloop * 'extra' contains various information about the join * 'outer_path' is the outer path * 'inner_path' is the inner path * 'restrict_clauses' are the Re

Source from the content-addressed store, hash-verified

3868 * Returns the resulting path node.
3869 */
3870Path *
3871create_nestloop_path(PlannerInfo *root,
3872 RelOptInfo *joinrel,
3873 JoinType jointype,
3874 JoinType orig_jointype, /* CDB */
3875 JoinCostWorkspace *workspace,
3876 JoinPathExtraData *extra,
3877 Path *outer_path,
3878 Path *inner_path,
3879 List *restrict_clauses,
3880 List *redistribution_clauses, /* CDB */
3881 List *pathkeys,
3882 Relids required_outer)
3883{
3884 NestPath *pathnode;
3885 CdbPathLocus join_locus;
3886 Relids outer_req_outer = PATH_REQ_OUTER(outer_path);
3887 bool outer_must_be_local = !bms_is_empty(outer_req_outer);
3888 Relids inner_req_outer = PATH_REQ_OUTER(inner_path);
3889 bool inner_must_be_local = !bms_is_empty(inner_req_outer);
3890 int rowidexpr_id;
3891 bool isParallel = (outer_path->locus.parallel_workers > 1 || inner_path->locus.parallel_workers > 1);
3892
3893 if (!isParallel)
3894 {
3895 /* Add motion nodes above subpaths and decide where to join. */
3896 join_locus = cdbpath_motion_for_join(root,
3897 orig_jointype,
3898 &outer_path, /* INOUT */
3899 &inner_path, /* INOUT */
3900 &rowidexpr_id, /* OUT */
3901 redistribution_clauses,
3902 restrict_clauses,
3903 pathkeys,
3904 NIL,
3905 outer_must_be_local,
3906 inner_must_be_local);
3907 }
3908 else
3909 {
3910 join_locus = cdbpath_motion_for_parallel_join(root,
3911 orig_jointype,
3912 &outer_path, /* INOUT */
3913 &inner_path, /* INOUT */
3914 &rowidexpr_id, /* OUT */
3915 redistribution_clauses,
3916 restrict_clauses,
3917 pathkeys,
3918 NIL,
3919 outer_must_be_local,
3920 inner_must_be_local,
3921 false);
3922 }
3923
3924 if (CdbPathLocus_IsNull(join_locus))
3925 return NULL;
3926
3927 /* Outer might not be ordered anymore after motion. */

Callers 2

try_nestloop_pathFunction · 0.85

Calls 14

bms_is_emptyFunction · 0.85
cdbpath_motion_for_joinFunction · 0.85
create_material_pathFunction · 0.85
bms_overlapFunction · 0.85
bms_unionFunction · 0.85
lappendFunction · 0.85
initial_cost_nestloopFunction · 0.85
final_cost_nestloopFunction · 0.85
create_unique_rowid_pathFunction · 0.85

Tested by

no test coverage detected