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