You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/09/22 17:23:01 UTC

[GitHub] [arrow] pitrou commented on a diff in pull request #14188: ARROW-17792: [C++] Use lambda capture move construction

pitrou commented on code in PR #14188:
URL: https://github.com/apache/arrow/pull/14188#discussion_r977913171


##########
cpp/src/arrow/dataset/dataset_writer.cc:
##########
@@ -174,19 +174,9 @@ class DatasetWriterFileQueue {
   }
 
   void ScheduleBatch(std::shared_ptr<RecordBatch> batch) {
-    // TODO(ARROW-17110) This task is only here to std::move the batch
-    // It can be a lambda once we adopt C++14
-    struct WriteTask : public util::AsyncTaskScheduler::Task {
-      WriteTask(DatasetWriterFileQueue* self, std::shared_ptr<RecordBatch> batch)
-          : self(self), batch(std::move(batch)) {}
-      Result<Future<>> operator()(util::AsyncTaskScheduler*) {
-        return self->WriteNext(std::move(batch));
-      }
-      DatasetWriterFileQueue* self;
-      std::shared_ptr<RecordBatch> batch;
-    };
-    scheduler_->AddTask(
-        ::arrow::internal::make_unique<WriteTask>(this, std::move(batch)));
+    scheduler_->AddSimpleTask([self = this, batch = std::move(batch)]() {

Review Comment:
   That's a good question. I think either way is ok.



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org