| 453 | } |
| 454 | |
| 455 | Future<std::shared_ptr<RecordBatch>> ReadNextAsync() override { |
| 456 | // On the first call, return the batch we used for initialization |
| 457 | if (ARROW_PREDICT_FALSE(first_block_)) { |
| 458 | bytes_processed_->fetch_add(first_block_->num_bytes); |
| 459 | auto batch = std::exchange(first_block_, std::nullopt)->record_batch; |
| 460 | return ToFuture(std::move(batch)); |
| 461 | } |
| 462 | return generator_(); |
| 463 | } |
| 464 | |
| 465 | [[nodiscard]] int64_t bytes_processed() const override { |
| 466 | return bytes_processed_->load(); |