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

Method Read

cpp/src/arrow/csv/reader.cc:985–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983 }
984
985 Result<std::shared_ptr<Table>> Read() override {
986 task_group_ = TaskGroup::MakeSerial(io_context_.stop_token());
987
988 // First block
989 ARROW_ASSIGN_OR_RAISE(auto first_buffer, buffer_iterator_.Next());
990 if (first_buffer == nullptr) {
991 return Status::Invalid("Empty CSV file");
992 }
993 RETURN_NOT_OK(ProcessHeader(first_buffer, &first_buffer));
994 RETURN_NOT_OK(MakeColumnBuilders());
995
996 auto block_iterator = SerialBlockReader::MakeIterator(
997 std::move(buffer_iterator_), MakeChunker(parse_options_), std::move(first_buffer),
998 read_options_.skip_rows_after_names);
999 while (true) {
1000 RETURN_NOT_OK(io_context_.stop_token().Poll());
1001
1002 ARROW_ASSIGN_OR_RAISE(auto maybe_block, block_iterator.Next());
1003 if (IsIterationEnd(maybe_block)) {
1004 // EOF
1005 break;
1006 }
1007 RETURN_NOT_OK(ParseAndInsert(maybe_block));
1008 }
1009 // Finish conversion, create schema and table
1010 RETURN_NOT_OK(task_group_->Finish());
1011 return MakeTable();
1012 }
1013
1014 protected:
1015 Iterator<std::shared_ptr<Buffer>> buffer_iterator_;

Callers

nothing calls this directly

Calls 6

IsIterationEndFunction · 0.85
MakeTableFunction · 0.85
PollMethod · 0.80
MakeChunkerFunction · 0.70
InvalidFunction · 0.50
FinishMethod · 0.45

Tested by

no test coverage detected