This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 3aa8b686031 [fix](be) return correct canceled status from scanner 
(#36392)
3aa8b686031 is described below

commit 3aa8b68603106f32b83ec515e3b786dfcb651992
Author: Jerry Hu <mrh...@gmail.com>
AuthorDate: Tue Jun 18 10:43:50 2024 +0800

    [fix](be) return correct canceled status from scanner (#36392)
---
 be/src/pipeline/exec/scan_operator.cpp   |  2 +-
 be/src/runtime/runtime_state.cpp         | 10 +++++++++-
 be/src/vec/exec/scan/scanner_context.cpp |  2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/be/src/pipeline/exec/scan_operator.cpp 
b/be/src/pipeline/exec/scan_operator.cpp
index ac115d43879..161a79fb7c1 100644
--- a/be/src/pipeline/exec/scan_operator.cpp
+++ b/be/src/pipeline/exec/scan_operator.cpp
@@ -1461,7 +1461,7 @@ Status 
ScanOperatorX<LocalStateType>::get_block(RuntimeState* state, vectorized:
         if (local_state._scanner_ctx) {
             local_state._scanner_ctx->stop_scanners(state);
         }
-        return Status::Cancelled("Query cancelled in ScanOperator");
+        return state->cancel_reason();
     }
 
     if (local_state._eos) {
diff --git a/be/src/runtime/runtime_state.cpp b/be/src/runtime/runtime_state.cpp
index 6626ada034c..137b5a84642 100644
--- a/be/src/runtime/runtime_state.cpp
+++ b/be/src/runtime/runtime_state.cpp
@@ -345,7 +345,15 @@ bool RuntimeState::is_cancelled() const {
 }
 
 Status RuntimeState::cancel_reason() const {
-    return _exec_status.status();
+    if (!_exec_status.ok()) {
+        return _exec_status.status();
+    }
+
+    if (_query_ctx) {
+        return _query_ctx->exec_status();
+    }
+
+    return Status::Cancelled("Query cancelled");
 }
 
 const int64_t MAX_ERROR_NUM = 50;
diff --git a/be/src/vec/exec/scan/scanner_context.cpp 
b/be/src/vec/exec/scan/scanner_context.cpp
index 6f7c41ff9b4..e15ec015908 100644
--- a/be/src/vec/exec/scan/scanner_context.cpp
+++ b/be/src/vec/exec/scan/scanner_context.cpp
@@ -215,7 +215,7 @@ Status ScannerContext::get_block_from_queue(RuntimeState* 
state, vectorized::Blo
                                             bool* eos, int id) {
     if (state->is_cancelled()) {
         _set_scanner_done();
-        return Status::Cancelled("Query cancelled in ScannerContext");
+        return state->cancel_reason();
     }
     std::unique_lock l(_transfer_lock);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to