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

Function create_hashjoin_path

src/backend/optimizer/util/pathnode.c:4327–4530  ·  view source on GitHub ↗

* create_hashjoin_path * Creates a pathnode corresponding to a hash join between two relations. * * 'joinrel' is the join relation * 'jointype' is the type of join required * 'workspace' is the result from initial_cost_hashjoin * 'extra' contains various information about the join * 'outer_path' is the cheapest outer path * 'inner_path' is the cheapest inner path * 'parallel_hash' to se

Source from the content-addressed store, hash-verified

4325 * (this should be a subset of the restrict_clauses list)
4326 */
4327Path *
4328create_hashjoin_path(PlannerInfo *root,
4329 RelOptInfo *joinrel,
4330 JoinType jointype,
4331 JoinType orig_jointype, /* CDB */
4332 JoinCostWorkspace *workspace,
4333 JoinPathExtraData *extra,
4334 Path *outer_path,
4335 Path *inner_path,
4336 bool parallel_hash,
4337 List *restrict_clauses,
4338 Relids required_outer,
4339 List *redistribution_clauses, /* CDB */
4340 List *hashclauses)
4341{
4342 HashPath *pathnode;
4343 CdbPathLocus join_locus;
4344 bool outer_must_be_local = !bms_is_empty(PATH_REQ_OUTER(outer_path));
4345 bool inner_must_be_local = !bms_is_empty(PATH_REQ_OUTER(inner_path));
4346 int rowidexpr_id;
4347
4348 /*
4349 * CBDB_PARALLEL_FIXME:
4350 * We do have outer_path(parallel_workers=0) when parallel_aware is true
4351 * as we try more partial hash join paths than upstream.
4352 * Are them reasonable? Better to remove them until we have a clear answer.
4353 */
4354 bool isParallel = (outer_path->locus.parallel_workers > 1 || inner_path->locus.parallel_workers > 1);
4355
4356 if (!isParallel)
4357 {
4358 /* Add motion nodes above subpaths and decide where to join. */
4359 join_locus = cdbpath_motion_for_join(root,
4360 orig_jointype,
4361 &outer_path, /* INOUT */
4362 &inner_path, /* INOUT */
4363 &rowidexpr_id,
4364 redistribution_clauses,
4365 restrict_clauses,
4366 NIL, /* don't care about ordering */
4367 NIL,
4368 outer_must_be_local,
4369 inner_must_be_local);
4370 }
4371 else
4372 {
4373 /* Parallel join logic */
4374 join_locus = cdbpath_motion_for_parallel_join(root,
4375 orig_jointype,
4376 &outer_path, /* INOUT */
4377 &inner_path, /* INOUT */
4378 &rowidexpr_id,
4379 redistribution_clauses,
4380 restrict_clauses,
4381 NIL, /* don't care about ordering */
4382 NIL,
4383 outer_must_be_local,
4384 inner_must_be_local,

Callers 2

try_hashjoin_pathFunction · 0.85

Calls 11

bms_is_emptyFunction · 0.85
cdbpath_motion_for_joinFunction · 0.85
ExecHashRowSizeFunction · 0.85
bms_unionFunction · 0.85
initial_cost_hashjoinFunction · 0.85
final_cost_hashjoinFunction · 0.85
create_unique_rowid_pathFunction · 0.85

Tested by

no test coverage detected