* 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
| 3868 | * Returns the resulting path node. |
| 3869 | */ |
| 3870 | Path * |
| 3871 | create_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. */ |
no test coverage detected