| 90 | } |
| 91 | |
| 92 | Status SelectNode::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) { |
| 93 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
| 94 | ScopedGetNextEventAdder ea(this, eos); |
| 95 | RETURN_IF_ERROR(ExecDebugAction(TExecNodePhase::GETNEXT, state)); |
| 96 | // start (or continue) consuming row batches from child |
| 97 | do { |
| 98 | RETURN_IF_CANCELLED(state); |
| 99 | RETURN_IF_ERROR(QueryMaintenance(state)); |
| 100 | if (child_row_batch_->num_rows() == 0) { |
| 101 | // Fetch rows from child if either child row batch has been |
| 102 | // consumed completely or it is empty. |
| 103 | RETURN_IF_ERROR(child(0)->GetNext(state, child_row_batch_.get(), &child_eos_)); |
| 104 | } |
| 105 | |
| 106 | SelectPlanNode::CopyRowsFn copy_rows_fn = codegend_copy_rows_fn_.load(); |
| 107 | if (copy_rows_fn != nullptr) { |
| 108 | copy_rows_fn(this, row_batch); |
| 109 | } else { |
| 110 | CopyRows(row_batch); |
| 111 | } |
| 112 | COUNTER_SET(rows_returned_counter_, rows_returned()); |
| 113 | *eos = ReachedLimit() |
| 114 | || (child_row_idx_ == child_row_batch_->num_rows() && child_eos_); |
| 115 | if (*eos || child_row_idx_ == child_row_batch_->num_rows()) { |
| 116 | child_row_idx_ = 0; |
| 117 | child_row_batch_->TransferResourceOwnership(row_batch); |
| 118 | child_row_batch_->Reset(); |
| 119 | } |
| 120 | } while (!*eos && !row_batch->AtCapacity()); |
| 121 | return Status::OK(); |
| 122 | } |
| 123 | |
| 124 | Status SelectNode::Reset(RuntimeState* state, RowBatch* row_batch) { |
| 125 | child_row_batch_->TransferResourceOwnership(row_batch); |
nothing calls this directly
no test coverage detected