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

Method Read

cpp/src/arrow/json/reader.cc:255–278  ·  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(
257 std::move(buffer_iterator_),
258 MakeChunker(decode_context_.parse_options(), decode_context_.pool()));
259
260 bool did_read = false;
261 while (true) {
262 ARROW_ASSIGN_OR_RAISE(auto block, block_it.Next());
263 if (IsIterationEnd(block)) break;
264 if (!did_read) {
265 did_read = true;
266 RETURN_NOT_OK(MakeBuilder());
267 }
268 task_group_->Append(
269 [self = shared_from_this(), block] { return self->ParseAndInsert(block); });
270 }
271 if (!did_read) {
272 return Status::Invalid("Empty JSON file");
273 }
274
275 std::shared_ptr<ChunkedArray> array;
276 RETURN_NOT_OK(builder_->Finish(&array));
277 return Table::FromChunkedStructArray(array);
278 }
279
280 private:
281 Status MakeBuilder() {

Callers 4

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

Calls 9

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

Tested by 3

ReadToTableFunction · 0.36
TEST_PFunction · 0.36
TESTFunction · 0.36