| 83 | } |
| 84 | |
| 85 | Status KuduScanNode::GetNext(RuntimeState* state, RowBatch* row_batch, bool* eos) { |
| 86 | SCOPED_TIMER(runtime_profile_->total_time_counter()); |
| 87 | ScopedGetNextEventAdder ea(this, eos); |
| 88 | RETURN_IF_ERROR(ExecDebugAction(TExecNodePhase::GETNEXT, state)); |
| 89 | RETURN_IF_CANCELLED(state); |
| 90 | RETURN_IF_ERROR(QueryMaintenance(state)); |
| 91 | |
| 92 | // If there are no scan tokens, nothing is ever placed in the materialized |
| 93 | // row batch, so exit early for this case. |
| 94 | if (NumScanTokens() == 0 || ReachedLimitShared()) { |
| 95 | *eos = true; |
| 96 | return Status::OK(); |
| 97 | } |
| 98 | |
| 99 | *eos = false; |
| 100 | unique_ptr<RowBatch> materialized_batch = thread_state_.batch_queue()->GetBatch(); |
| 101 | if (materialized_batch != NULL) { |
| 102 | row_batch->AcquireState(materialized_batch.get()); |
| 103 | if (CheckLimitAndTruncateRowBatchIfNeededShared(row_batch, eos)) { |
| 104 | SetDone(); |
| 105 | } |
| 106 | COUNTER_SET(rows_returned_counter_, rows_returned_shared()); |
| 107 | materialized_batch.reset(); |
| 108 | } else { |
| 109 | *eos = true; |
| 110 | } |
| 111 | |
| 112 | unique_lock<mutex> l(lock_); |
| 113 | return status_; |
| 114 | } |
| 115 | |
| 116 | void KuduScanNode::Close(RuntimeState* state) { |
| 117 | if (is_closed()) return; |
no test coverage detected