Gets a batch. Returns true if there is more data to process, false if we are done or an error occurred
| 541 | /// Gets a batch. Returns true if there is more data to process, false if we |
| 542 | /// are done or an error occurred |
| 543 | bool PollOnce() { |
| 544 | std::lock_guard<std::mutex> guard(gate); |
| 545 | if (!CheckEnded()) { |
| 546 | return false; |
| 547 | } |
| 548 | |
| 549 | // Process batches while we have data |
| 550 | for (;;) { |
| 551 | Result<std::shared_ptr<RecordBatch>> result = getNextBatch(); |
| 552 | |
| 553 | if (result.ok()) { |
| 554 | auto out_rb = *result; |
| 555 | if (!out_rb) { |
| 556 | break; |
| 557 | } |
| 558 | ExecBatch out_b(*out_rb); |
| 559 | out_b.index = batches_produced++; |
| 560 | Status st = output_->InputReceived(this, std::move(out_b)); |
| 561 | if (!st.ok()) { |
| 562 | ARROW_LOG(FATAL) << "Error in output_::InputReceived: " << st.ToString(); |
| 563 | EndFromProcessThread(std::move(st)); |
| 564 | } |
| 565 | } else { |
| 566 | EndFromProcessThread(result.status()); |
| 567 | return false; |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | // Report to the output the total batch count, if we've already |
| 572 | // finished everything (there are two places where this can happen: |
| 573 | // here and InputFinished) |
| 574 | // |
| 575 | // It may happen here in cases where InputFinished was called before |
| 576 | // we were finished producing results (so we didn't know the output |
| 577 | // size at that time) |
| 578 | if (!CheckEnded()) { |
| 579 | return false; |
| 580 | } |
| 581 | |
| 582 | // There is no more we can do now but there is still work remaining |
| 583 | // for later when more data arrives. |
| 584 | return true; |
| 585 | } |
| 586 | |
| 587 | #ifdef ARROW_ENABLE_THREADING |
| 588 | void EmitBatches() { |
nothing calls this directly
no test coverage detected