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

Method StreamingReaderImpl

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

Source from the content-addressed store, hash-verified

353class StreamingReaderImpl : public StreamingReader {
354 public:
355 StreamingReaderImpl(DecodedBlock first_block, AsyncGenerator<DecodedBlock> source,
356 const std::shared_ptr<DecodeContext>& context, int max_readahead)
357 : first_block_(std::move(first_block)),
358 schema_(first_block_->record_batch->schema()),
359 bytes_processed_(std::make_shared<std::atomic<int64_t>>(0)) {
360 // Set the final schema for future invocations of the source generator
361 context->SetStrictSchema(schema_);
362 if (max_readahead > 0) {
363 source = MakeReadaheadGenerator(std::move(source), max_readahead);
364 }
365 generator_ = MakeMappedGenerator(
366 std::move(source), [counter = bytes_processed_](const DecodedBlock& out) {
367 counter->fetch_add(out.num_bytes);
368 return out.record_batch;
369 });
370 }
371
372 static Future<std::shared_ptr<StreamingReaderImpl>> MakeAsync(
373 std::shared_ptr<DecodeContext> context, std::shared_ptr<io::InputStream> stream,

Callers

nothing calls this directly

Calls 4

MakeReadaheadGeneratorFunction · 0.85
MakeMappedGeneratorFunction · 0.85
SetStrictSchemaMethod · 0.80
schemaMethod · 0.45

Tested by

no test coverage detected