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

Function MakeDecodingGenerator

cpp/src/arrow/json/reader.cc:333–351  ·  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

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