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


##########
cpp/src/arrow/compute/exec/source_node.cc:
##########
@@ -131,22 +131,23 @@ struct SourceNode : ExecNode {
                              bit_util::CeilDiv(morsel_length, 
ExecPlan::kMaxBatchSize));
                          batch_count_ += num_batches;
                        }
-                       RETURN_NOT_OK(plan_->ScheduleTask([=]() {
-                         int64_t offset = 0;
-                         do {
-                           int64_t batch_size = std::min<int64_t>(
-                               morsel_length - offset, 
ExecPlan::kMaxBatchSize);
-                           // In order for the legacy batching model to work 
we must
-                           // not slice batches from the source
-                           if (use_legacy_batching) {
-                             batch_size = morsel_length;
-                           }
-                           ExecBatch batch = morsel.Slice(offset, batch_size);
-                           offset += batch_size;
-                           outputs_[0]->InputReceived(this, std::move(batch));
-                         } while (offset < morsel.length);
-                         return Status::OK();
-                       }));
+                       RETURN_NOT_OK(plan_->ScheduleTask(

Review Comment:
   This cascade of nested callbacks is not the most readable code, except 
perhaps for Lisp fans...



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