MCPcopy Create free account
hub / github.com/apache/arrow / ToTableAsync

Method ToTableAsync

cpp/src/arrow/dataset/scanner.cc:711–733  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

709}
710
711Future<std::shared_ptr<Table>> AsyncScanner::ToTableAsync(Executor* cpu_executor) {
712 auto scan_options = scan_options_;
713 ARROW_ASSIGN_OR_RAISE(
714 auto positioned_batch_gen,
715 ScanBatchesUnorderedAsync(cpu_executor, /*sequence_fragments=*/false,
716 /*use_legacy_batching=*/true));
717 /// Wraps the state in a shared_ptr to ensure that failing ScanTasks don't
718 /// invalidate concurrently running tasks when Finish() early returns
719 /// and the mutex/batches fail out of scope.
720 auto state = std::make_shared<AsyncTableAssemblyState>();
721
722 auto table_building_task = [state](const EnumeratedRecordBatch& batch) {
723 state->Emplace(batch);
724 return batch;
725 };
726
727 auto table_building_gen =
728 MakeMappedGenerator(positioned_batch_gen, table_building_task);
729
730 return DiscardAllFromAsyncGenerator(table_building_gen).Then([state, scan_options]() {
731 return Table::FromRecordBatches(scan_options->projected_schema, state->Finish());
732 });
733}
734
735Future<int64_t> AsyncScanner::CountRowsAsync(Executor* executor) {
736 ARROW_ASSIGN_OR_RAISE(auto fragment_gen, GetFragments());

Callers

nothing calls this directly

Calls 5

MakeMappedGeneratorFunction · 0.85
ThenMethod · 0.80
EmplaceMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected