diff --git a/cpp/src/arrow/csv/reader.cc b/cpp/src/arrow/csv/reader.cc index ff2bb7608c835..30fc0bc6aca44 100644 --- a/cpp/src/arrow/csv/reader.cc +++ b/cpp/src/arrow/csv/reader.cc @@ -1112,18 +1112,18 @@ class AsyncThreadedTableReader protected: Future> ProcessFirstBuffer() { // First block - auto self = shared_from_this(); auto first_buffer_future = buffer_generator_(); - return first_buffer_future.Then([self](const std::shared_ptr& first_buffer) - -> Result> { - if (first_buffer == nullptr) { - return Status::Invalid("Empty CSV file"); - } - std::shared_ptr first_buffer_processed; - RETURN_NOT_OK(self->ProcessHeader(first_buffer, &first_buffer_processed)); - RETURN_NOT_OK(self->MakeColumnBuilders()); - return first_buffer_processed; - }); + return first_buffer_future.Then( + [self = shared_from_this()](const std::shared_ptr& first_buffer) + -> Result> { + if (first_buffer == nullptr) { + return Status::Invalid("Empty CSV file"); + } + std::shared_ptr first_buffer_processed; + RETURN_NOT_OK(self->ProcessHeader(first_buffer, &first_buffer_processed)); + RETURN_NOT_OK(self->MakeColumnBuilders()); + return first_buffer_processed; + }); } Executor* cpu_executor_; diff --git a/cpp/src/parquet/arrow/reader.cc b/cpp/src/parquet/arrow/reader.cc index 0739b828a0afe..80c21518eb3a1 100644 --- a/cpp/src/parquet/arrow/reader.cc +++ b/cpp/src/parquet/arrow/reader.cc @@ -1122,9 +1122,8 @@ class RowGroupGenerator { } else { auto ready = reader->parquet_reader()->WhenBuffered({row_group}, column_indices); if (cpu_executor_) ready = cpu_executor_->TransferAlways(ready); - auto cpu_executor = cpu_executor_; row_group_read = - ready.Then([cpu_executor, reader, row_group, + ready.Then([cpu_executor = cpu_executor_, reader, row_group, column_indices = std::move( column_indices)]() -> ::arrow::Future { return ReadOneRowGroup(cpu_executor, reader, row_group, column_indices);