| 1036 | }; |
| 1037 | |
| 1038 | void EndFromProcessThread(Status st = Status::OK()) { |
| 1039 | // We must spawn a new task to transfer off the process thread when |
| 1040 | // marking this finished. Otherwise there is a chance that doing so could |
| 1041 | // mark the plan finished which may destroy the plan which will destroy this |
| 1042 | // node which will cause us to join on ourselves. |
| 1043 | ARROW_UNUSED( |
| 1044 | plan_->query_context()->executor()->Spawn([this, st = std::move(st)]() mutable { |
| 1045 | Defer cleanup([this, &st]() { process_task_.MarkFinished(st); }); |
| 1046 | if (st.ok()) { |
| 1047 | st = output_->InputFinished(this, batches_produced_); |
| 1048 | } |
| 1049 | for (size_t i = 0; i < state_.size(); ++i) { |
| 1050 | const auto& s = state_[i]; |
| 1051 | s->ForceShutdown(); |
| 1052 | st &= inputs_[i]->StopProducing(); |
| 1053 | } |
| 1054 | })); |
| 1055 | } |
| 1056 | |
| 1057 | bool CheckEnded() { |
| 1058 | if (state_.at(0)->Finished()) { |
nothing calls this directly
no test coverage detected