| 77 | std::shared_ptr<Schema> schema; |
| 78 | |
| 79 | AsyncGenerator<std::optional<ExecBatch>> gen(bool parallel, bool slow) const { |
| 80 | auto opt_batches = ::arrow::internal::MapVector( |
| 81 | [](ExecBatch batch) { return std::make_optional(std::move(batch)); }, batches); |
| 82 | |
| 83 | AsyncGenerator<std::optional<ExecBatch>> gen; |
| 84 | |
| 85 | if (parallel) { |
| 86 | // emulate batches completing initial decode-after-scan on a cpu thread |
| 87 | gen = MakeBackgroundGenerator(MakeVectorIterator(std::move(opt_batches)), |
| 88 | ::arrow::internal::GetCpuThreadPool()) |
| 89 | .ValueOrDie(); |
| 90 | |
| 91 | // ensure that callbacks are not executed immediately on a background thread |
| 92 | gen = |
| 93 | MakeTransferredGenerator(std::move(gen), ::arrow::internal::GetCpuThreadPool()); |
| 94 | } else { |
| 95 | gen = MakeVectorGenerator(std::move(opt_batches)); |
| 96 | } |
| 97 | |
| 98 | if (slow) { |
| 99 | gen = |
| 100 | MakeMappedGenerator(std::move(gen), [](const std::optional<ExecBatch>& batch) { |
| 101 | SleepABit(); |
| 102 | return batch; |
| 103 | }); |
| 104 | } |
| 105 | |
| 106 | return gen; |
| 107 | } |
| 108 | }; |
| 109 | |
| 110 | Future<> StartAndFinish(ExecPlan* plan); |
no test coverage detected