| 221 | } |
| 222 | |
| 223 | Status SortNode::SortInput(RuntimeState* state) { |
| 224 | RowBatch batch(child(0)->row_desc(), state->batch_size(), mem_tracker()); |
| 225 | bool eos; |
| 226 | do { |
| 227 | RETURN_IF_ERROR(child(0)->GetNext(state, &batch, &eos)); |
| 228 | |
| 229 | MonotonicStopWatch timer; |
| 230 | timer.Start(); |
| 231 | Status add_status = sorter_->AddBatch(&batch); |
| 232 | timer.Stop(); |
| 233 | add_batch_timer_->UpdateCounter(timer.ElapsedTime()); |
| 234 | if (UNLIKELY(!add_status.ok())) return add_status; |
| 235 | |
| 236 | batch.Reset(); |
| 237 | RETURN_IF_CANCELLED(state); |
| 238 | RETURN_IF_ERROR(QueryMaintenance(state)); |
| 239 | } while(!eos); |
| 240 | |
| 241 | // Unless we are inside a subplan expecting to call Open()/GetNext() on the child |
| 242 | // again, the child can be closed at this point to release resources. |
| 243 | if (!IsInSubplan()) child(0)->Close(state); |
| 244 | |
| 245 | RETURN_IF_ERROR(sorter_->InputDone()); |
| 246 | return Status::OK(); |
| 247 | } |
| 248 | |
| 249 | } |
nothing calls this directly
no test coverage detected