Returns the next batch from the cache. Expands the cache if necessary. If a new batch is created, its memory is tracked against 'mem_tracker'.
| 41 | /// Returns the next batch from the cache. Expands the cache if necessary. |
| 42 | /// If a new batch is created, its memory is tracked against 'mem_tracker'. |
| 43 | RowBatch* GetNextBatch(MemTracker* mem_tracker) { |
| 44 | if (next_row_batch_idx_ >= row_batches_.size()) { |
| 45 | // Expand the cache with a new row batch. |
| 46 | row_batches_.push_back( |
| 47 | std::make_unique<RowBatch>(row_desc_, batch_size_, mem_tracker)); |
| 48 | } else { |
| 49 | // Reset batch from the cache before returning it. |
| 50 | row_batches_[next_row_batch_idx_]->Reset(); |
| 51 | } |
| 52 | return row_batches_[next_row_batch_idx_++].get(); |
| 53 | } |
| 54 | |
| 55 | /// Resets the cache such that subsequent calls to GetNextBatch() return batches from |
| 56 | /// the beginning of the cache. All batches previously returned by GetNextBatch() |
no test coverage detected