yiguolei commented on code in PR #29605:
URL: https://github.com/apache/doris/pull/29605#discussion_r1442820353


##########
be/src/vec/sink/vresult_file_sink.cpp:
##########
@@ -110,41 +113,52 @@ Status VResultFileSink::open(RuntimeState* state) {
     return AsyncWriterSink::open(state);
 }
 
-Status VResultFileSink::close(RuntimeState* state, Status exec_status) {
-    if (_closed) {
-        return Status::OK();
+Status VResultFileSink::try_close(RuntimeState* state, Status /*exec_status*/) 
{
+    if (_writer == nullptr) {
+        LOG_WARNING("writer of result file sink is not initialized");
+        return Status::RuntimeError("writer of result file sink is not 
initialized");
     }
 
-    Status final_status = exec_status;
-    // close the writer
-    if (_writer && _writer->need_normal_close()) {
-        Status st = _writer->close();
-        if (!st.ok() && exec_status.ok()) {
-            // close file writer failed, should return this error to client
-            final_status = st;
-        }
+    RETURN_IF_ERROR(_writer->try_close(state, Status::OK()));
+
+    if (!_is_top_sink) {
+        RETURN_IF_ERROR(_stream_sender->send(state, _output_block.get(), 
true));
+        RETURN_IF_ERROR(_stream_sender->close(state, Status::OK()));
+        _output_block->clear();
+    }
+
+    return Status::OK();
+}
+
+Status VResultFileSink::close(RuntimeState* state, Status /*exec_status*/) {
+    if (_writer == nullptr) {
+        LOG_WARNING("writer of result file sink is not initialized");
+        return Status::RuntimeError("writer of result file sink is not 
initialized");
     }
+
+    auto try_close_status = Status::OK();
+    // PlanFragmentExecutor does not call DataSink::try_close() so we need to 
call it manually
+    if (!state->enable_pipeline_exec()) {

Review Comment:
   not need call this, we should call this in plan fragment executor



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to