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

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

commit 81a537ed7883eab198e24cc14b01e94cb214407b
Author: Gabriel <gabrielleeb...@gmail.com>
AuthorDate: Fri Mar 1 09:48:33 2024 +0800

    [pipelineX](bug) Fix aggregate crash if open failed (#31625)
---
 be/src/pipeline/exec/aggregation_sink_operator.cpp | 1 +
 be/src/pipeline/pipeline_x/dependency.h            | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/be/src/pipeline/exec/aggregation_sink_operator.cpp 
b/be/src/pipeline/exec/aggregation_sink_operator.cpp
index 55b301c0742..9871711be23 100644
--- a/be/src/pipeline/exec/aggregation_sink_operator.cpp
+++ b/be/src/pipeline/exec/aggregation_sink_operator.cpp
@@ -157,6 +157,7 @@ Status AggSinkLocalState::open(RuntimeState* state) {
         // _create_agg_status may acquire a lot of memory, may allocate failed 
when memory is very few
         
RETURN_IF_CATCH_EXCEPTION(static_cast<void>(_create_agg_status(_agg_data->without_key)));
     }
+    Base::_shared_state->ready_to_execute = true;
     return Status::OK();
 }
 
diff --git a/be/src/pipeline/pipeline_x/dependency.h 
b/be/src/pipeline/pipeline_x/dependency.h
index 1733a8fd291..596ef8bc6fc 100644
--- a/be/src/pipeline/pipeline_x/dependency.h
+++ b/be/src/pipeline/pipeline_x/dependency.h
@@ -330,9 +330,9 @@ public:
         agg_arena_pool = std::make_unique<vectorized::Arena>();
     }
     ~AggSharedState() override {
-        if (probe_expr_ctxs.empty()) {
+        if (probe_expr_ctxs.empty() && ready_to_execute) {
             _close_without_key();
-        } else {
+        } else if (ready_to_execute) {
             _close_with_serialized_key();
         }
     }
@@ -366,6 +366,7 @@ public:
     };
     MemoryRecord mem_usage_record;
     bool agg_data_created_without_key = false;
+    std::atomic<bool> ready_to_execute = false;
 
 private:
     void _close_with_serialized_key() {


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

Reply via email to