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 (apache#6934)

(cherry picked from commit 80078cd)
  • Loading branch information
zhztheplayer authored and wForget committed Oct 31, 2024
1 parent 67cde8c commit 0fc9e31
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 @@ -194,7 +194,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 0fc9e31

Please sign in to comment.