| 1253 | } |
| 1254 | |
| 1255 | void FetchNext() { |
| 1256 | size_t row_group_index = readahead_index_++; |
| 1257 | int row_group = row_groups_[row_group_index]; |
| 1258 | std::vector<int> column_indices = column_indices_; |
| 1259 | auto reader = arrow_reader_; |
| 1260 | int64_t num_rows = |
| 1261 | reader->parquet_reader()->metadata()->RowGroup(row_group)->num_rows(); |
| 1262 | rows_in_flight_ += num_rows; |
| 1263 | ::arrow::Future<RecordBatchGenerator> row_group_read; |
| 1264 | if (!reader->properties().pre_buffer()) { |
| 1265 | row_group_read = SubmitRead(cpu_executor_, reader, row_group, column_indices); |
| 1266 | } else { |
| 1267 | auto ready = reader->parquet_reader()->WhenBuffered({row_group}, column_indices); |
| 1268 | if (cpu_executor_) ready = cpu_executor_->TransferAlways(ready); |
| 1269 | row_group_read = |
| 1270 | ready.Then([cpu_executor = cpu_executor_, reader, row_group, |
| 1271 | column_indices = std::move( |
| 1272 | column_indices)]() -> ::arrow::Future<RecordBatchGenerator> { |
| 1273 | return ReadOneRowGroup(cpu_executor, reader, row_group, column_indices); |
| 1274 | }); |
| 1275 | } |
| 1276 | in_flight_reads_.push({std::move(row_group_read), num_rows}); |
| 1277 | } |
| 1278 | |
| 1279 | // Synchronous fallback for when pre-buffer isn't enabled. |
| 1280 | // |
nothing calls this directly
no test coverage detected