Avoid consistency problem when has no more data (#1716)

This commit is contained in:
Yunfeng,Wu
2019-08-29 18:57:49 +08:00
committed by Mingyu Chen
parent 7a0c7f45b2
commit ecbdfc2cee
2 changed files with 6 additions and 2 deletions

View File

@ -222,8 +222,8 @@ Status MemoryScratchSink::close(RuntimeState* state, Status exec_status) {
if (_closed) {
return Status::OK();
}
// shutdown queue, then blocking_get return false, put sentinel
if (_queue) {
// put sentinel
if (_queue != nullptr) {
_queue->blocking_put(nullptr);
}
Expr::close(_output_expr_ctxs, state);

View File

@ -47,6 +47,10 @@ Status ResultQueueMgr::fetch_result(const TUniqueId& fragment_instance_id, std::
// sentinel nullptr indicates scan end
if (*result == nullptr) {
*eos = true;
// put sentinel for consistency, avoid repeated invoking fetch result when hava no rowbatch
if (queue != nullptr) {
queue->blocking_put(nullptr);
}
} else {
*eos = false;
}