hsutter commented on code in PR #51270:
URL: https://github.com/apache/arrow/pull/51270#discussion_r3994249210


##########
cpp/src/arrow/acero/exec_plan.cc:
##########
@@ -1150,10 +1150,10 @@ ExecFactoryRegistry* default_exec_factory_registry() {
 }
 
 Result<std::function<Future<std::optional<ExecBatch>>()>> MakeReaderGenerator(
-    std::shared_ptr<RecordBatchReader> reader, ::arrow::internal::Executor* 
io_executor,
+    const std::shared_ptr<RecordBatchReader>& reader, 
::arrow::internal::Executor* io_executor,
     int max_q, int q_restart) {
   auto batch_it = MakeMapIterator(
-      [](std::shared_ptr<RecordBatch> batch) {
+      [](const std::shared_ptr<RecordBatch>& batch) {
         return std::make_optional(ExecBatch(*batch));
       },
       MakeIteratorFromReader(reader));

Review Comment:
   @pitrou, thanks again.
   
   Can you help me to understand this feedback please...
   
   1) I'm not sure how `MakeIteratorFromReader` is related. That's outside the 
lambda whose parameter is being changed here?
   
   2) The lambda only dereferences `batch`. Doesn't currently taking `batch` by 
value add a (needless?) inc/dec on the refcount? Isn't changing it to pass by 
`const&` a strict improvement?
   
   Again, my apologies if I'm missing something here or asking a silly 
question! I don't know this code base well and I appreciate your feedback.



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