You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/30 11:03:43 UTC

[incubator-doris] branch master updated: [Bugfix(Vec)] Close result_sink properly (#9849)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 85f525e991 [Bugfix(Vec)] Close result_sink properly (#9849)
85f525e991 is described below

commit 85f525e991dfa99887e92981f0d94a45c0a9ded7
Author: Amos Bird <am...@gmail.com>
AuthorDate: Mon May 30 19:03:33 2022 +0800

    [Bugfix(Vec)] Close result_sink properly (#9849)
    
    Close result_sink properly so that error code is reported and
    expr_context is always closed.
---
 be/src/vec/sink/result_sink.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/be/src/vec/sink/result_sink.cpp b/be/src/vec/sink/result_sink.cpp
index ce3ac086cc..02da2c7326 100644
--- a/be/src/vec/sink/result_sink.cpp
+++ b/be/src/vec/sink/result_sink.cpp
@@ -94,21 +94,24 @@ Status VResultSink::send(RuntimeState* state, Block* block) {
 }
 
 Status VResultSink::close(RuntimeState* state, Status exec_status) {
-    if (_closed || _writer == nullptr || _sender == nullptr) {
+    if (_closed) {
         return Status::OK();
     }
 
     Status final_status = exec_status;
-    // close the writer
-    Status st = _writer->close();
-    if (!st.ok() && exec_status.ok()) {
-        // close file writer failed, should return this error to client
-        final_status = st;
+
+    if (_writer) {
+        // close the writer
+        Status st = _writer->close();
+        if (!st.ok() && exec_status.ok()) {
+            // close file writer failed, should return this error to client
+            final_status = st;
+        }
     }
 
     // close sender, this is normal path end
     if (_sender) {
-        _sender->update_num_written_rows(_writer->get_written_rows());
+        if (_writer) _sender->update_num_written_rows(_writer->get_written_rows());
         _sender->close(final_status);
     }
     state->exec_env()->result_mgr()->cancel_at_time(


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