Skip to content

Commit

Permalink
[GLUTEN-6908][VL] Fix error when getting output from a Velox task tha…
Browse files Browse the repository at this point in the history
…t is under spilling by background thread (#6934)
  • Loading branch information
zhztheplayer authored Aug 21, 2024
1 parent e0602e9 commit 80078cd
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,22 @@ std::shared_ptr<ColumnarBatch> WholeStageResultIterator::next() {
if (task_->isFinished()) {
return nullptr;
}
velox::RowVectorPtr vector = task_->next();
velox::RowVectorPtr vector;
while (true) {
auto future = velox::ContinueFuture::makeEmpty();
auto out = task_->next(&future);
if (!future.valid()) {
// Not need to wait. Break.
vector = std::move(out);
break;
}
// Velox suggested to wait. This might be because another thread (e.g., background io thread) is spilling the task.
GLUTEN_CHECK(out == nullptr, "Expected to wait but still got non-null output from Velox task");
VLOG(2) << "Velox task " << task_->taskId()
<< " is busy when ::next() is called. Will wait and try again. Task state: "
<< taskStateString(task_->state());
future.wait();
}
if (vector == nullptr) {
return nullptr;
}
Expand Down

0 comments on commit 80078cd

Please sign in to comment.