| 447 | bst_idx_t n_batches_{0}; |
| 448 | |
| 449 | void Fetch() final { |
| 450 | page_ = std::make_shared<SparsePage>(); |
| 451 | // The first round of reading, this is responsible for initialization. |
| 452 | if (!this->ReadCache()) { |
| 453 | bool type_error{false}; |
| 454 | CHECK(proxy_); |
| 455 | cpu_impl::DispatchAny( |
| 456 | proxy_, |
| 457 | [&](auto const& adapter_batch) { |
| 458 | page_->Push(adapter_batch, this->missing_, this->nthreads_); |
| 459 | }, |
| 460 | &type_error); |
| 461 | if (type_error) { |
| 462 | DevicePush(proxy_, missing_, page_.get()); |
| 463 | } |
| 464 | |
| 465 | page_->SetBaseRowId(base_row_id_); |
| 466 | base_row_id_ += page_->Size(); |
| 467 | this->n_batches_++; |
| 468 | this->WriteCache(); |
| 469 | } |
| 470 | } |
| 471 | |
| 472 | public: |
| 473 | SparsePageSource(DataIterProxy<DataIterResetCallback, XGDMatrixCallbackNext> iter, |
no test coverage detected