| 941 | } |
| 942 | |
| 943 | Status Init() override { |
| 944 | QueryContext* ctx = plan_->query_context(); |
| 945 | if (ctx->options().use_legacy_batching) { |
| 946 | return Status::Invalid( |
| 947 | "The plan was configured to use legacy batching but contained a join node " |
| 948 | "which is incompatible with legacy batching"); |
| 949 | } |
| 950 | |
| 951 | bool use_sync_execution = ctx->executor()->GetCapacity() == 1; |
| 952 | // TODO(ARROW-15732) |
| 953 | // Each side of join might have an IO thread being called from. Once this is fixed |
| 954 | // we will change it back to just the CPU's thread pool capacity. |
| 955 | size_t num_threads = (GetCpuThreadPoolCapacity() + io::GetIOThreadPoolCapacity() + 1); |
| 956 | |
| 957 | RETURN_NOT_OK(pushdown_context_.Init( |
| 958 | this, num_threads, |
| 959 | [ctx](std::function<Status(size_t, int64_t)> fn, |
| 960 | std::function<Status(size_t)> on_finished) { |
| 961 | return ctx->RegisterTaskGroup(std::move(fn), std::move(on_finished)); |
| 962 | }, |
| 963 | [ctx](int task_group_id, int64_t num_tasks) { |
| 964 | return ctx->StartTaskGroup(task_group_id, num_tasks); |
| 965 | }, |
| 966 | [this](size_t thread_index) { return OnFiltersReceived(thread_index); }, |
| 967 | disable_bloom_filter_, use_sync_execution)); |
| 968 | |
| 969 | RETURN_NOT_OK(impl_->Init( |
| 970 | ctx, join_type_, num_threads, &(schema_mgr_->proj_maps[0]), |
| 971 | &(schema_mgr_->proj_maps[1]), key_cmp_, filter_, |
| 972 | [ctx](std::function<Status(size_t, int64_t)> fn, |
| 973 | std::function<Status(size_t)> on_finished) { |
| 974 | return ctx->RegisterTaskGroup(std::move(fn), std::move(on_finished)); |
| 975 | }, |
| 976 | [ctx](int task_group_id, int64_t num_tasks) { |
| 977 | return ctx->StartTaskGroup(task_group_id, num_tasks); |
| 978 | }, |
| 979 | [this](int64_t, ExecBatch batch) { return this->OutputBatchCallback(batch); }, |
| 980 | [this](int64_t total_num_batches) { |
| 981 | return this->FinishedCallback(total_num_batches); |
| 982 | })); |
| 983 | |
| 984 | task_group_probe_ = ctx->RegisterTaskGroup( |
| 985 | [this](size_t thread_index, int64_t task_id) -> Status { |
| 986 | return impl_->ProbeSingleBatch(thread_index, |
| 987 | std::move(queued_batches_to_probe_[task_id])); |
| 988 | }, |
| 989 | [this](size_t thread_index) -> Status { |
| 990 | return OnQueuedBatchesProbed(thread_index); |
| 991 | }); |
| 992 | |
| 993 | return Status::OK(); |
| 994 | } |
| 995 | |
| 996 | Status StartProducing() override { |
| 997 | NoteStartProducing(ToStringExtra()); |
nothing calls this directly
no test coverage detected