| 1145 | } |
| 1146 | |
| 1147 | void FetchNext() { |
| 1148 | size_t row_group_index = readahead_index_++; |
| 1149 | int row_group = row_groups_[row_group_index]; |
| 1150 | std::vector<int> column_indices = column_indices_; |
| 1151 | auto reader = arrow_reader_; |
| 1152 | int64_t num_rows = |
| 1153 | reader->parquet_reader()->metadata()->RowGroup(row_group)->num_rows(); |
| 1154 | rows_in_flight_ += num_rows; |
| 1155 | ::arrow::Future<RecordBatchGenerator> row_group_read; |
| 1156 | if (!reader->properties().pre_buffer()) { |
| 1157 | row_group_read = SubmitRead(cpu_executor_, reader, row_group, column_indices); |
| 1158 | } else { |
| 1159 | auto ready = reader->parquet_reader()->WhenBuffered({row_group}, column_indices); |
| 1160 | if (cpu_executor_) ready = cpu_executor_->TransferAlways(ready); |
| 1161 | row_group_read = |
| 1162 | ready.Then([cpu_executor = cpu_executor_, reader, row_group, |
| 1163 | column_indices = std::move( |
| 1164 | column_indices)]() -> ::arrow::Future<RecordBatchGenerator> { |
| 1165 | return ReadOneRowGroup(cpu_executor, reader, row_group, column_indices); |
| 1166 | }); |
| 1167 | } |
| 1168 | in_flight_reads_.push({std::move(row_group_read), num_rows}); |
| 1169 | } |
| 1170 | |
| 1171 | // Synchronous fallback for when pre-buffer isn't enabled. |
| 1172 | // |
nothing calls this directly
no test coverage detected