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

Method Init

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

Source from the content-addressed store, hash-verified

1170
1171 private:
1172 Future<> Init(const std::shared_ptr<CSVRowCounter>& self) {
1173 ARROW_ASSIGN_OR_RAISE(auto istream_it,
1174 io::MakeInputStreamIterator(input_, read_options_.block_size));
1175 // TODO Consider exposing readahead as a read option (ARROW-12090)
1176 ARROW_ASSIGN_OR_RAISE(auto bg_it, MakeBackgroundGenerator(std::move(istream_it),
1177 io_context_.executor()));
1178 auto transferred_it = MakeTransferredGenerator(bg_it, cpu_executor_);
1179 auto buffer_generator = CSVBufferIterator::MakeAsync(std::move(transferred_it));
1180
1181 return buffer_generator().Then(
1182 [self, buffer_generator](std::shared_ptr<Buffer> first_buffer) {
1183 if (!first_buffer) {
1184 return Status::Invalid("Empty CSV file");
1185 }
1186 RETURN_NOT_OK(self->ProcessHeader(first_buffer, &first_buffer));
1187 self->block_generator_ = SerialBlockReader::MakeAsyncIterator(
1188 buffer_generator, MakeChunker(self->parse_options_),
1189 std::move(first_buffer), 0);
1190 return Status::OK();
1191 });
1192 }
1193
1194 Future<int64_t> DoCount(const std::shared_ptr<CSVRowCounter>& self) {
1195 // count_cb must return a value instead of Status/Future<> to work with

Callers 2

MakeTableReaderFunction · 0.45
MakeStreamingReaderFunction · 0.45

Calls 6

MakeTransferredGeneratorFunction · 0.85
ThenMethod · 0.80
ProcessHeaderMethod · 0.80
MakeChunkerFunction · 0.70
InvalidFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected