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

Function try_mergejoin_path

src/backend/optimizer/path/joinpath.c:928–1021  ·  view source on GitHub ↗

* try_mergejoin_path * Consider a merge join path; if it appears useful, push it into * the joinrel's pathlist via add_path(). */

Source from the content-addressed store, hash-verified

926 * the joinrel's pathlist via add_path().
927 */
928static void
929try_mergejoin_path(PlannerInfo *root,
930 RelOptInfo *joinrel,
931 Path *outer_path,
932 Path *inner_path,
933 List *pathkeys,
934 List *mergeclauses,
935 List *outersortkeys,
936 List *innersortkeys,
937 JoinType jointype,
938 JoinType orig_jointype,
939 JoinPathExtraData *extra,
940 bool is_partial)
941{
942 Relids required_outer;
943 JoinCostWorkspace workspace;
944
945 if (is_partial)
946 {
947 try_partial_mergejoin_path(root,
948 joinrel,
949 outer_path,
950 inner_path,
951 pathkeys,
952 mergeclauses,
953 outersortkeys,
954 innersortkeys,
955 jointype,
956 orig_jointype,
957 extra);
958 return;
959 }
960
961 /*
962 * Check to see if proposed path is still parameterized, and reject if the
963 * parameterization wouldn't be sensible.
964 */
965 required_outer = calc_non_nestloop_required_outer(outer_path,
966 inner_path);
967 if (required_outer &&
968 !bms_overlap(required_outer, extra->param_source_rels))
969 {
970 /* Waste no memory when we reject a path here */
971 bms_free(required_outer);
972 return;
973 }
974
975 /*
976 * If the given paths are already well enough ordered, we can skip doing
977 * an explicit sort.
978 */
979 if (outersortkeys &&
980 pathkeys_contained_in(outersortkeys, outer_path->pathkeys))
981 outersortkeys = NIL;
982 if (innersortkeys &&
983 pathkeys_contained_in(innersortkeys, inner_path->pathkeys))
984 innersortkeys = NIL;
985

Callers 2

sort_inner_and_outerFunction · 0.85
generate_mergejoin_pathsFunction · 0.85

Calls 9

bms_overlapFunction · 0.85
bms_freeFunction · 0.85
pathkeys_contained_inFunction · 0.85
initial_cost_mergejoinFunction · 0.85
add_path_precheckFunction · 0.85
add_pathFunction · 0.85
create_mergejoin_pathFunction · 0.85

Tested by

no test coverage detected