| 170 | } |
| 171 | |
| 172 | void StopProducing() { |
| 173 | if (plan_status_ == PLAN_RUNNING) { |
| 174 | // We're done with the plan, but it may still need some time |
| 175 | // to finish and clean up after itself. To do this, we give a |
| 176 | // callable with its own copy of the shared_ptr<ExecPlan> so |
| 177 | // that it can delete itself when it is safe to do so. |
| 178 | std::shared_ptr<arrow::acero::ExecPlan> plan(plan_); |
| 179 | bool not_finished_yet = plan_->finished().TryAddCallback( |
| 180 | [&plan] { return [plan](const arrow::Status&) {}; }); |
| 181 | |
| 182 | if (not_finished_yet) { |
| 183 | plan_->StopProducing(); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | plan_status_ = PLAN_FINISHED; |
| 188 | // A previous version of this called plan_.reset() and reset |
| 189 | // sink_gen_ to an empty generator; however, this caused |
| 190 | // crashes on some platforms. |
| 191 | } |
| 192 | }; |
| 193 | |
| 194 | // [[acero::export]] |
nothing calls this directly
no test coverage detected