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

Method Init

cpp/src/arrow/acero/hash_join_node.cc:943–994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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());

Callers

nothing calls this directly

Calls 14

OutputBatchCallbackMethod · 0.95
FinishedCallbackMethod · 0.95
query_contextMethod · 0.80
InvalidFunction · 0.50
GetCpuThreadPoolCapacityFunction · 0.50
GetIOThreadPoolCapacityFunction · 0.50
OKFunction · 0.50
optionsMethod · 0.45
GetCapacityMethod · 0.45
executorMethod · 0.45
InitMethod · 0.45
RegisterTaskGroupMethod · 0.45

Tested by

no test coverage detected