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



##########
File path: cpp/src/arrow/util/async_generator.h
##########
@@ -65,6 +100,14 @@ Future<> VisitAsyncGenerator(AsyncGenerator<T> generator,
   return Loop(LoopBody{std::move(generator), std::move(visitor)});
 }
 
+/// \brief Waits for an async generator to complete, discarding results.
+template <typename T>
+Future<> AwaitAsyncGenerator(AsyncGenerator<T> generator) {

Review comment:
       I'm not the biggest fan of discard either as it implies to me the 
generator is doing nothing but I agree that "await" isn't very clear.  I've 
switched to discard.  This is used in the Scanner::ToTable method because the 
callbacks are side-effecting a table builder and after they've all run we can 
get a table out of the builder.

##########
File path: cpp/src/arrow/util/async_generator.h
##########
@@ -65,6 +100,14 @@ Future<> VisitAsyncGenerator(AsyncGenerator<T> generator,
   return Loop(LoopBody{std::move(generator), std::move(visitor)});
 }
 
+/// \brief Waits for an async generator to complete, discarding results.
+template <typename T>
+Future<> AwaitAsyncGenerator(AsyncGenerator<T> generator) {
+  std::function<Status(T)> visitor = [](...) { return Status::OK(); };
+  return VisitAsyncGenerator(generator, visitor);
+}  // namespace arrow

Review comment:
       Done.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to