| 479 | } |
| 480 | |
| 481 | Status Sorter::Run::GetNextBatch(RowBatch** output_batch) { |
| 482 | DCHECK(buffered_batch_ != nullptr); |
| 483 | buffered_batch_->Reset(); |
| 484 | // Fill more rows into buffered_batch_. |
| 485 | bool eos; |
| 486 | if (HasVarLenPages() && !is_pinned_) { |
| 487 | RETURN_IF_ERROR(GetNext<true>(buffered_batch_.get(), &eos)); |
| 488 | } else { |
| 489 | RETURN_IF_ERROR(GetNext<false>(buffered_batch_.get(), &eos)); |
| 490 | } |
| 491 | |
| 492 | if (eos) { |
| 493 | // Setting output_batch to nullptr signals eos to the caller, so GetNext() is not |
| 494 | // allowed to attach resources to the batch on eos. |
| 495 | DCHECK_EQ(buffered_batch_->num_rows(), 0); |
| 496 | DCHECK_EQ(buffered_batch_->num_buffers(), 0); |
| 497 | *output_batch = nullptr; |
| 498 | return Status::OK(); |
| 499 | } |
| 500 | *output_batch = buffered_batch_.get(); |
| 501 | return Status::OK(); |
| 502 | } |
| 503 | |
| 504 | template <bool CONVERT_OFFSET_TO_PTR> |
| 505 | Status Sorter::Run::GetNext(RowBatch* output_batch, bool* eos) { |
nothing calls this directly
no test coverage detected