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 c7134faea98b87365e74f65186d7a4265a1713d8 Author: Tiewei Fang <[email protected]> AuthorDate: Tue May 14 23:17:08 2024 +0800 [Fix](outfile) Fix the timing of setting the _is_closed flag in Parquet/ORC writer (#34668) --- be/src/vec/runtime/vorc_transformer.cpp | 2 +- be/src/vec/runtime/vparquet_transformer.cpp | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/be/src/vec/runtime/vorc_transformer.cpp b/be/src/vec/runtime/vorc_transformer.cpp index ab92a7be543..732503eb922 100644 --- a/be/src/vec/runtime/vorc_transformer.cpp +++ b/be/src/vec/runtime/vorc_transformer.cpp @@ -77,8 +77,8 @@ VOrcOutputStream::~VOrcOutputStream() { void VOrcOutputStream::close() { if (!_is_closed) { + Defer defer {[this] { _is_closed = true; }}; Status st = _file_writer->close(); - _is_closed = true; if (!st.ok()) { LOG(WARNING) << "close orc output stream failed: " << st; throw std::runtime_error(st.to_string()); diff --git a/be/src/vec/runtime/vparquet_transformer.cpp b/be/src/vec/runtime/vparquet_transformer.cpp index 0e5800750b0..561bc726131 100644 --- a/be/src/vec/runtime/vparquet_transformer.cpp +++ b/be/src/vec/runtime/vparquet_transformer.cpp @@ -99,15 +99,14 @@ arrow::Result<int64_t> ParquetOutputStream::Tell() const { } arrow::Status ParquetOutputStream::Close() { - if (_is_closed) { - return arrow::Status::OK(); - } - Status st = _file_writer->close(); - if (!st.ok()) { - LOG(WARNING) << "close parquet output stream failed: " << st; - return arrow::Status::IOError(st.to_string()); + if (!_is_closed) { + Defer defer {[this] { _is_closed = true; }}; + Status st = _file_writer->close(); + if (!st.ok()) { + LOG(WARNING) << "close parquet output stream failed: " << st; + return arrow::Status::IOError(st.to_string()); + } } - _is_closed = true; return arrow::Status::OK(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
