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

Method Read

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

Source from the content-addressed store, hash-verified

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