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

Method Init

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

Source from the content-addressed store, hash-verified

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