| 457 | }; |
| 458 | |
| 459 | bool hasNext() override { |
| 460 | if (next_) { |
| 461 | return true; |
| 462 | } |
| 463 | if (!task_->isRunning()) { |
| 464 | return false; |
| 465 | } |
| 466 | while (true) { |
| 467 | ContinueFuture future = ContinueFuture::makeEmpty(); |
| 468 | RowVectorPtr next = task_->next(&future); |
| 469 | if (next != nullptr) { |
| 470 | next_ = next; |
| 471 | return true; |
| 472 | } |
| 473 | // When next is returned from task as a null pointer. |
| 474 | if (!future.valid()) { |
| 475 | BOLT_CHECK(!task_->isRunning() || !noMoreSplits_); |
| 476 | return false; |
| 477 | } |
| 478 | // Task is blocked for some reason. Wait and try again. |
| 479 | BOLT_CHECK_NULL(next); |
| 480 | future.wait(); |
| 481 | } |
| 482 | }; |
| 483 | |
| 484 | RowVectorPtr& current() override { |
| 485 | return current_; |