MCPcopy Create free account
hub / github.com/apache/arrow / ExecNode_Join

Function ExecNode_Join

r/src/compute-exec.cpp:409–449  ·  view source on GitHub ↗

[[acero::export]]

Source from the content-addressed store, hash-verified

407
408// [[acero::export]]
409std::shared_ptr<acero::ExecNode> ExecNode_Join(
410 const std::shared_ptr<acero::ExecNode>& input, acero::JoinType join_type,
411 const std::shared_ptr<acero::ExecNode>& right_data,
412 std::vector<std::string> left_keys, std::vector<std::string> right_keys,
413 std::vector<std::string> left_output, std::vector<std::string> right_output,
414 std::string output_suffix_for_left, std::string output_suffix_for_right,
415 bool na_matches) {
416 std::vector<arrow::FieldRef> left_refs, right_refs, left_out_refs, right_out_refs;
417 std::vector<acero::JoinKeyCmp> key_cmps;
418 for (auto&& name : left_keys) {
419 left_refs.emplace_back(std::move(name));
420 // Populate key_cmps in this loop, one for each key
421 // Note that Acero supports having different values for each key, but dplyr
422 // only supports one value for all keys, so we're only going to support that
423 // for now.
424 key_cmps.emplace_back(na_matches ? acero::JoinKeyCmp::IS : acero::JoinKeyCmp::EQ);
425 }
426 for (auto&& name : right_keys) {
427 right_refs.emplace_back(std::move(name));
428 }
429 for (auto&& name : left_output) {
430 left_out_refs.emplace_back(std::move(name));
431 }
432 // dplyr::semi_join => LEFT_SEMI; dplyr::anti_join => LEFT_ANTI
433 // So ignoring RIGHT_SEMI and RIGHT_ANTI here because dplyr doesn't implement them.
434 if (join_type != acero::JoinType::LEFT_SEMI &&
435 join_type != acero::JoinType::LEFT_ANTI) {
436 // Don't include out_refs in semi/anti join
437 for (auto&& name : right_output) {
438 right_out_refs.emplace_back(std::move(name));
439 }
440 }
441
442 return MakeExecNodeOrStop(
443 "hashjoin", input->plan(), {input.get(), right_data.get()},
444 acero::HashJoinNodeOptions{join_type, std::move(left_refs), std::move(right_refs),
445 std::move(left_out_refs), std::move(right_out_refs),
446 std::move(key_cmps), compute::literal(true),
447 std::move(output_suffix_for_left),
448 std::move(output_suffix_for_right)});
449}
450
451// [[acero::export]]
452std::shared_ptr<acero::ExecNode> ExecNode_Union(

Callers 1

_arrow_ExecNode_JoinFunction · 0.85

Calls 4

MakeExecNodeOrStopFunction · 0.85
emplace_backMethod · 0.80
literalFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected