Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GLUTEN-6908][VL] Fix error when getting output from a Velox task that is under spilling by background thread #6934

Merged
merged 6 commits into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
FelixYBW marked this conversation as resolved.
Show resolved Hide resolved
<< " 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
Loading