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

Method next

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

Source from the content-addressed store, hash-verified

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