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

Function try_partial_hashjoin_path

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

* try_partial_hashjoin_path * Consider a partial hashjoin join path; if it appears useful, push it into * the joinrel's partial_pathlist via add_partial_path(). * The outer side is partial. If parallel_hash is true, then the inner path * must be partial and will be run in parallel to create one or more shared * hash tables; otherwise the inner path must be complete and a copy of it

Source from the content-addressed store, hash-verified

1170 * is run in every process to create separate identical private hash tables.
1171 */
1172static void
1173try_partial_hashjoin_path(PlannerInfo *root,
1174 RelOptInfo *joinrel,
1175 Path *outer_path,
1176 Path *inner_path,
1177 List *hashclauses,
1178 JoinType jointype,
1179 JoinType orig_jointype,
1180 JoinPathExtraData *extra,
1181 bool parallel_hash)
1182{
1183 JoinCostWorkspace workspace;
1184 Path *hashpath;
1185
1186 /*
1187 * If the inner path is parameterized, the parameterization must be fully
1188 * satisfied by the proposed outer path. Parameterized partial paths are
1189 * not supported. The caller should already have verified that no lateral
1190 * rels are required here.
1191 */
1192 Assert(bms_is_empty(joinrel->lateral_relids));
1193 if (inner_path->param_info != NULL)
1194 {
1195 Relids inner_paramrels = inner_path->param_info->ppi_req_outer;
1196
1197 if (!bms_is_empty(inner_paramrels))
1198 return;
1199 }
1200
1201 /*
1202 * Before creating a path, get a quick lower bound on what it is likely to
1203 * cost. Bail out right away if it looks terrible.
1204 */
1205 initial_cost_hashjoin(root, &workspace, jointype, hashclauses,
1206 outer_path, inner_path, extra, parallel_hash);
1207 if (!add_partial_path_precheck(joinrel, workspace.total_cost, NIL))
1208 return;
1209
1210 hashpath = create_hashjoin_path(root,
1211 joinrel,
1212 jointype,
1213 orig_jointype,
1214 &workspace,
1215 extra,
1216 outer_path,
1217 inner_path,
1218 parallel_hash,
1219 extra->restrictlist,
1220 NULL,
1221 extra->redistribution_clauses,
1222 hashclauses);
1223
1224 /* Might be good enough to be worth trying and no motion, so let's try it. */
1225 if (hashpath && hashpath->parallel_safe)
1226 add_partial_path(joinrel, hashpath);
1227}
1228
1229/*

Callers 1

hash_inner_and_outerFunction · 0.85

Calls 5

bms_is_emptyFunction · 0.85
initial_cost_hashjoinFunction · 0.85
create_hashjoin_pathFunction · 0.85
add_partial_pathFunction · 0.85

Tested by

no test coverage detected