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