westonpace commented on a change in pull request #9095:
URL: https://github.com/apache/arrow/pull/9095#discussion_r565980902



##########
File path: cpp/src/arrow/csv/reader.cc
##########
@@ -220,14 +238,36 @@ class ThreadedBlockReader : public BlockReader {
  public:
   using BlockReader::BlockReader;
 
-  Result<arrow::util::optional<CSVBlock>> Next() {
+  static Iterator<util::optional<CSVBlock>> MakeIterator(
+      Iterator<std::shared_ptr<Buffer>> buffer_iterator, 
std::unique_ptr<Chunker> chunker,
+      std::shared_ptr<Buffer> first_buffer) {
+    auto block_reader =
+        std::make_shared<ThreadedBlockReader>(std::move(chunker), 
first_buffer);
+    // Wrap shared pointer in callable
+    Transformer<std::shared_ptr<Buffer>, util::optional<CSVBlock>> 
block_reader_fn =
+        [block_reader](std::shared_ptr<Buffer> next) { return 
(*block_reader)(next); };
+    return MakeTransformedIterator(std::move(buffer_iterator), 
block_reader_fn);
+  }
+
+  static AsyncGenerator<util::optional<CSVBlock>> MakeAsyncIterator(
+      AsyncGenerator<std::shared_ptr<Buffer>> buffer_generator,
+      std::unique_ptr<Chunker> chunker, std::shared_ptr<Buffer> first_buffer) {
+    auto block_reader =
+        std::make_shared<ThreadedBlockReader>(std::move(chunker), 
first_buffer);
+    // Wrap shared pointer in callable
+    Transformer<std::shared_ptr<Buffer>, util::optional<CSVBlock>> 
block_reader_fn =
+        [block_reader](std::shared_ptr<Buffer> next) { return 
(*block_reader)(next); };
+    return TransformAsyncGenerator(buffer_generator, block_reader_fn);

Review comment:
       Fixed.




----------------------------------------------------------------
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.

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


Reply via email to