lidavidm commented on a change in pull request #9589: URL: https://github.com/apache/arrow/pull/9589#discussion_r612725112
########## File path: cpp/src/arrow/dataset/scanner.cc ########## @@ -182,7 +273,30 @@ Result<FragmentIterator> SyncScanner::GetFragments() { return GetFragmentsFromDatasets({dataset_}, scan_options_->filter); } -Result<ScanTaskIterator> SyncScanner::Scan() { +Result<ScanTaskIterator> SyncScanner::Scan() { return ScanInternal(); } + +Status SyncScanner::Scan(std::function<Status(TaggedRecordBatch)> visitor) { + ARROW_ASSIGN_OR_RAISE(auto scan_task_it, ScanInternal()); + + auto task_group = scan_options_->TaskGroup(); + + for (auto maybe_scan_task : scan_task_it) { + ARROW_ASSIGN_OR_RAISE(auto scan_task, maybe_scan_task); + task_group->Append([scan_task, visitor] { + ARROW_ASSIGN_OR_RAISE(auto batch_it, scan_task->Execute()); Review comment: Or actually, 11887 is probably okay and the only part is reverting file_csv.cc changes in 12161. -- 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