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

Method GetNextUnpartitioned

be/src/exec/topn-node.cc:389–418  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389Status TopNNode::GetNextUnpartitioned(
390 RuntimeState* state, RowBatch* row_batch, bool* eos) {
391 DCHECK(!is_partitioned());
392 RETURN_IF_CANCELLED(state);
393 RETURN_IF_ERROR(QueryMaintenance(state));
394 while (!row_batch->AtCapacity() && (get_next_iter_ != sorted_top_n_.end())) {
395 if (num_rows_skipped_ < offset_) {
396 ++get_next_iter_;
397 ++num_rows_skipped_;
398 continue;
399 }
400 int row_idx = row_batch->AddRow();
401 TupleRow* dst_row = row_batch->GetRow(row_idx);
402 Tuple* src_tuple = *get_next_iter_;
403 TupleRow* src_row = reinterpret_cast<TupleRow*>(&src_tuple);
404 row_batch->CopyRow(src_row, dst_row);
405 ++get_next_iter_;
406 row_batch->CommitLastRow();
407 IncrementNumRowsReturned(1);
408 }
409 *eos = get_next_iter_ == sorted_top_n_.end();
410
411 // Transfer ownership of tuple data to output batch.
412 // TODO: To improve performance for small inputs when this node is run multiple times
413 // inside a subplan, we might choose to only selectively transfer, e.g., when the
414 // block(s) in the pool are all full or when the pool has reached a certain size.
415 if (*eos) row_batch->tuple_data_pool()->AcquireData(tuple_pool_.get(), false);
416 COUNTER_SET(rows_returned_counter_, rows_returned());
417 return Status::OK();
418}
419
420Status TopNNode::GetNextPartitioned(
421 RuntimeState* state, RowBatch* batch, bool* eos) {

Callers

nothing calls this directly

Calls 10

OKFunction · 0.85
CopyRowMethod · 0.80
CommitLastRowMethod · 0.80
AcquireDataMethod · 0.80
tuple_data_poolMethod · 0.80
getMethod · 0.65
AtCapacityMethod · 0.45
endMethod · 0.45
AddRowMethod · 0.45
GetRowMethod · 0.45

Tested by

no test coverage detected