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

Function try_hashjoin_path

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

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

Source from the content-addressed store, hash-verified

1100 * the joinrel's pathlist via add_path().
1101 */
1102static void
1103try_hashjoin_path(PlannerInfo *root,
1104 RelOptInfo *joinrel,
1105 Path *outer_path,
1106 Path *inner_path,
1107 List *hashclauses,
1108 JoinType jointype,
1109 JoinType orig_jointype,
1110 JoinPathExtraData *extra)
1111{
1112 Relids required_outer;
1113 JoinCostWorkspace workspace;
1114
1115 /*
1116 * Check to see if proposed path is still parameterized, and reject if the
1117 * parameterization wouldn't be sensible.
1118 */
1119 required_outer = calc_non_nestloop_required_outer(outer_path,
1120 inner_path);
1121 if (required_outer &&
1122 !bms_overlap(required_outer, extra->param_source_rels))
1123 {
1124 /* Waste no memory when we reject a path here */
1125 bms_free(required_outer);
1126 return;
1127 }
1128
1129 /*
1130 * See comments in try_nestloop_path(). Also note that hashjoin paths
1131 * never have any output pathkeys, per comments in create_hashjoin_path.
1132 */
1133 initial_cost_hashjoin(root, &workspace, jointype, hashclauses,
1134 outer_path, inner_path, extra, false);
1135
1136 if (add_path_precheck(joinrel,
1137 workspace.startup_cost, workspace.total_cost,
1138 NIL, required_outer))
1139 {
1140 add_path(joinrel, (Path *)
1141 create_hashjoin_path(root,
1142 joinrel,
1143 jointype,
1144 orig_jointype,
1145 &workspace,
1146 extra,
1147 outer_path,
1148 inner_path,
1149 false, /* parallel_hash */
1150 extra->restrictlist,
1151 required_outer,
1152 extra->redistribution_clauses,
1153 hashclauses),
1154 root);
1155 }
1156 else
1157 {
1158 /* Waste no memory when we reject a path here */
1159 bms_free(required_outer);

Callers 1

hash_inner_and_outerFunction · 0.85

Calls 7

bms_overlapFunction · 0.85
bms_freeFunction · 0.85
initial_cost_hashjoinFunction · 0.85
add_path_precheckFunction · 0.85
add_pathFunction · 0.85
create_hashjoin_pathFunction · 0.85

Tested by

no test coverage detected