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

Method gen

cpp/src/arrow/dataset/test_util_internal.h:79–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
110Future<> StartAndFinish(ExecPlan* plan);

Callers 1

Calls 9

MapVectorFunction · 0.85
MakeBackgroundGeneratorFunction · 0.85
MakeVectorIteratorFunction · 0.85
GetCpuThreadPoolFunction · 0.85
MakeTransferredGeneratorFunction · 0.85
MakeVectorGeneratorFunction · 0.85
MakeMappedGeneratorFunction · 0.85
SleepABitFunction · 0.85
ValueOrDieMethod · 0.80

Tested by

no test coverage detected