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

Function clause_sides_match_join

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

* clause_sides_match_join * Determine whether a join clause is of the right form to use in this join. * * We already know that the clause is a binary opclause referencing only the * rels in the current join. The point here is to check whether it has the * form "outerrel_expr op innerrel_expr" or "innerrel_expr op outerrel_expr", * rather than mixing outer and inner vars on either side. I

Source from the content-addressed store, hash-verified

1237 * we set the transient flag outer_is_left to identify which side is which.
1238 */
1239static inline bool
1240clause_sides_match_join(RestrictInfo *rinfo, RelOptInfo *outerrel,
1241 RelOptInfo *innerrel)
1242{
1243 if (bms_is_subset(rinfo->left_relids, outerrel->relids) &&
1244 bms_is_subset(rinfo->right_relids, innerrel->relids))
1245 {
1246 /* lefthand side is outer */
1247 rinfo->outer_is_left = true;
1248 return true;
1249 }
1250 else if (bms_is_subset(rinfo->left_relids, innerrel->relids) &&
1251 bms_is_subset(rinfo->right_relids, outerrel->relids))
1252 {
1253 /* righthand side is outer */
1254 rinfo->outer_is_left = false;
1255 return true;
1256 }
1257 return false; /* no good for these input relations */
1258}
1259
1260/*
1261 * sort_inner_and_outer

Callers 4

hash_inner_and_outerFunction · 0.70
select_mergejoin_clausesFunction · 0.70

Calls 1

bms_is_subsetFunction · 0.85

Tested by

no test coverage detected