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

Method Read

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

Source from the content-addressed store, hash-verified

253 }
254
255 Result<std::shared_ptr<Table>> Read() override {
256 auto block_it = MakeChunkingIterator(std::move(buffer_iterator_),
257 MakeChunker(decode_context_.parse_options()));
258
259 bool did_read = false;
260 while (true) {
261 ARROW_ASSIGN_OR_RAISE(auto block, block_it.Next());
262 if (IsIterationEnd(block)) break;
263 if (!did_read) {
264 did_read = true;
265 RETURN_NOT_OK(MakeBuilder());
266 }
267 task_group_->Append(
268 [self = shared_from_this(), block] { return self->ParseAndInsert(block); });
269 }
270 if (!did_read) {
271 return Status::Invalid("Empty JSON file");
272 }
273
274 std::shared_ptr<ChunkedArray> array;
275 RETURN_NOT_OK(builder_->Finish(&array));
276 return Table::FromChunkedStructArray(array);
277 }
278
279 private:
280 Status MakeBuilder() {

Callers 4

ReadToTableFunction · 0.45
TEST_PFunction · 0.45
TESTFunction · 0.45
BenchmarkJSONReadingFunction · 0.45

Calls 8

ParseAndInsertMethod · 0.95
MakeChunkingIteratorFunction · 0.85
IsIterationEndFunction · 0.85
MakeChunkerFunction · 0.70
MakeBuilderFunction · 0.50
InvalidFunction · 0.50
AppendMethod · 0.45
FinishMethod · 0.45

Tested by 3

ReadToTableFunction · 0.36
TEST_PFunction · 0.36
TESTFunction · 0.36