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

Method next

cpp/src/arrow/c/bridge.cc:2537–2565  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2535 : queue_size_{queue_size}, mapper_{std::move(mapper)} {}
2536
2537 Result<RecordBatchWithMetadata> next() {
2538 TaskWithMetadata task;
2539 {
2540 std::unique_lock<std::mutex> lock(mutex_);
2541 cv_.wait(lock,
2542 [&] { return !error_.ok() || !batches_.empty() || end_of_stream_; });
2543 if (!error_.ok()) {
2544 return error_;
2545 }
2546
2547 if (batches_.empty() && end_of_stream_) {
2548 return IterationEnd<RecordBatchWithMetadata>();
2549 }
2550
2551 task = std::move(batches_.front());
2552 batches_.pop();
2553 }
2554
2555 producer_->request(producer_, 1);
2556 ArrowDeviceArray out;
2557 if (task.task_.extract_data(&task.task_, &out) != 0) {
2558 std::unique_lock<std::mutex> lock(mutex_);
2559 cv_.wait(lock, [&] { return !error_.ok(); });
2560 return error_;
2561 }
2562
2563 ARROW_ASSIGN_OR_RAISE(auto batch, ImportDeviceRecordBatch(&out, schema_, mapper_));
2564 return RecordBatchWithMetadata{std::move(batch), std::move(task.metadata_)};
2565 }
2566
2567 const uint64_t queue_size_;
2568 const DeviceMemoryMapper mapper_;

Callers 1

NextMethod · 0.45

Calls 4

extract_dataMethod · 0.80
okMethod · 0.45
emptyMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected