MCPcopy Create free account
hub / github.com/apache/impala / PrepareRead

Method PrepareRead

be/src/runtime/sorter.cc:452–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452Status Sorter::Run::PrepareRead() {
453 DCHECK(is_finalized_);
454 DCHECK(is_sorted_);
455
456 fixed_len_pages_index_ = 0;
457 fixed_len_page_offset_ = 0;
458 var_len_pages_index_ = 0;
459 end_of_fixed_len_page_ = end_of_var_len_page_ = fixed_len_pages_.empty();
460 num_tuples_returned_ = 0;
461
462 buffered_batch_.reset(new RowBatch(
463 sorter_->output_row_desc_, sorter_->state_->batch_size(), sorter_->mem_tracker_));
464
465 // If the run is pinned, all pages are already pinned, so we're ready to read.
466 if (is_pinned_) return Status::OK();
467
468 // Pins the first fixed len page.
469 if (!fixed_len_pages_.empty()) {
470 RETURN_IF_ERROR(fixed_len_pages_[0].Pin(sorter_->buffer_pool_client_));
471 }
472
473 // Pins the first var len page if there is any.
474 if (HasVarLenPages()) {
475 RETURN_IF_ERROR(var_len_pages_[0].Pin(sorter_->buffer_pool_client_));
476 }
477
478 return Status::OK();
479}
480
481Status Sorter::Run::GetNextBatch(RowBatch** output_batch) {
482 DCHECK(buffered_batch_ != nullptr);

Callers 2

InputDoneMethod · 0.80
CreateMergerMethod · 0.80

Calls 5

OKFunction · 0.85
batch_sizeMethod · 0.80
resetMethod · 0.65
emptyMethod · 0.45
PinMethod · 0.45

Tested by

no test coverage detected