Skip to content

Commit

Permalink
[GLUTEN-6908][VL] Fix error when get output from a Velox task that is…
Browse files Browse the repository at this point in the history
… under spilling by background thread
  • Loading branch information
zhztheplayer committed Aug 20, 2024
1 parent 221f0f8 commit 93f2656
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cpp/velox/compute/WholeStageResultIterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,18 @@ 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. Return.
break;
}
// Velox suggested to wait. This might be because another thread (e.g., bckground io thread) is spilling the task.
GLUTEN_CHECK(out == nullptr, "Expected to wait but still got non-null output from Velox task");
future.wait();
}
if (vector == nullptr) {
return nullptr;
}
Expand Down

0 comments on commit 93f2656

Please sign in to comment.