lidavidm commented on a change in pull request #11616:
URL: https://github.com/apache/arrow/pull/11616#discussion_r785224012



##########
File path: cpp/src/arrow/ipc/reader.cc
##########
@@ -1088,10 +1163,33 @@ class RecordBatchFileReaderImpl : public 
RecordBatchFileReader {
     return Status::OK();
   }
 
+  Future<std::shared_ptr<RecordBatch>> ReadRecordBatchAsync(int i) {
+    DCHECK_GE(i, 0);
+    DCHECK_LT(i, num_record_batches());
+
+    auto cached_metadata = cached_metadata_.find(i);
+    if (cached_metadata != cached_metadata_.end()) {
+      return ReadCachedRecordBatch(i, cached_metadata->second);
+    }
+
+    return Status::Invalid(
+        "Asynchronous record batch reading is only supported after a call to "
+        "PreBufferMetadata or PreBufferBatches");
+  }
+
   Result<std::shared_ptr<RecordBatch>> ReadRecordBatch(int i) override {
     DCHECK_GE(i, 0);
     DCHECK_LT(i, num_record_batches());
 
+    auto cached_metadata = cached_metadata_.find(i);
+    if (cached_metadata != cached_metadata_.end()) {
+      return ReadCachedRecordBatch(i, cached_metadata->second).result();
+    }
+
+    // FIXME: What if they have prebuffered metadata and so the dictionary 
read has
+    // started but this batch wasn't prebuffered and so the dictionaries 
haven't been
+    // finished getting read yet.

Review comment:
       That's fair. It would be weird to mix the async and sync versions too.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to