| 87 | } |
| 88 | |
| 89 | void NonGroupingAggregator::GetSingletonOutput(RowBatch* row_batch) { |
| 90 | int row_idx = row_batch->AddRow(); |
| 91 | TupleRow* row = row_batch->GetRow(row_idx); |
| 92 | row_batch->ClearRow(row); |
| 93 | // The output row batch may reference memory allocated by Serialize() or Finalize(), |
| 94 | // allocating that memory directly from the row batch's pool means we can safely return |
| 95 | // the batch. |
| 96 | vector<ScopedResultsPool> allocate_from_batch_pool = |
| 97 | ScopedResultsPool::Create(agg_fn_evals_, row_batch->tuple_data_pool()); |
| 98 | Tuple* output_tuple = GetOutputTuple( |
| 99 | agg_fn_evals_, singleton_output_tuple_, row_batch->tuple_data_pool()); |
| 100 | row->SetTuple(agg_idx_, output_tuple); |
| 101 | if (ExecNode::EvalConjuncts(conjunct_evals_.data(), conjunct_evals_.size(), row)) { |
| 102 | row_batch->CommitLastRow(); |
| 103 | ++num_rows_returned_; |
| 104 | COUNTER_SET(rows_returned_counter_, num_rows_returned_); |
| 105 | } |
| 106 | // Keep the current chunk to amortize the memory allocation over a series |
| 107 | // of Reset()/Open()/GetNext()* calls. |
| 108 | row_batch->tuple_data_pool()->AcquireData(singleton_tuple_pool_.get(), true); |
| 109 | // This node no longer owns the memory for singleton_output_tuple_. |
| 110 | singleton_output_tuple_ = nullptr; |
| 111 | } |
| 112 | |
| 113 | void NonGroupingAggregator::Close(RuntimeState* state) { |
| 114 | if (!singleton_output_tuple_returned_) { |
nothing calls this directly
no test coverage detected