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

Function MakeDecodingGenerator

cpp/src/arrow/json/reader.cc:334–352  ·  view source on GitHub ↗

Reads from a source iterator, completes the subsequent decode task on the calling thread. This is only really used for compatibility with the async pipeline when CPU threading is disabled

Source from the content-addressed store, hash-verified

332// thread. This is only really used for compatibility with the async pipeline when CPU
333// threading is disabled
334AsyncGenerator<DecodedBlock> MakeDecodingGenerator(
335 Iterator<ChunkedBlock> source,
336 std::function<Result<DecodedBlock>(const ChunkedBlock&)> decoder) {
337 struct State {
338 Iterator<ChunkedBlock> source;
339 std::function<Result<DecodedBlock>(const ChunkedBlock&)> decoder;
340 } state{std::move(source), std::move(decoder)};
341 return [state = std::make_shared<State>(std::move(state))] {
342 auto maybe_block = state->source.Next();
343 if (!maybe_block.ok()) {
344 return Future<DecodedBlock>::MakeFinished(maybe_block.status());
345 }
346 const auto& block = maybe_block.ValueUnsafe();
347 if (IsIterationEnd(block)) {
348 return ToFuture(IterationEnd<DecodedBlock>());
349 }
350 return ToFuture(state->decoder(block));
351 };
352}
353
354class StreamingReaderImpl : public StreamingReader {
355 public:

Callers 1

MakeAsyncMethod · 0.85

Calls 6

IsIterationEndFunction · 0.85
ToFutureFunction · 0.85
ValueUnsafeMethod · 0.80
NextMethod · 0.45
okMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected