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

Method ProduceCallback

cpp/src/arrow/acero/tpch_node.cc:2716–2736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2714
2715 private:
2716 Status ProduceCallback(size_t thread_index) {
2717 if (done_.load()) return Status::OK();
2718 ARROW_ASSIGN_OR_RAISE(std::optional<ExecBatch> maybe_batch,
2719 gen_->NextPartBatch(thread_index));
2720 if (!maybe_batch.has_value()) {
2721 int64_t batches_generated = gen_->part_batches_generated();
2722 if (batches_generated == batches_outputted_.load()) {
2723 bool expected = false;
2724 if (done_.compare_exchange_strong(expected, true))
2725 ARROW_RETURN_NOT_OK(finished_callback_(batches_outputted_.load()));
2726 return Status::OK();
2727 }
2728 return schedule_callback_(
2729 [this](size_t thread_index) { return this->ProduceCallback(thread_index); });
2730 }
2731 ExecBatch batch = std::move(*maybe_batch);
2732 ARROW_RETURN_NOT_OK(output_callback_(std::move(batch)));
2733 batches_outputted_++;
2734 return schedule_callback_(
2735 [this](size_t thread_index) { return this->ProduceCallback(thread_index); });
2736 }
2737
2738 OutputBatchCallback output_callback_;
2739 FinishedCallback finished_callback_;

Callers 1

StartProducingMethod · 0.95

Calls 5

NextPartBatchMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.70
OKFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected