This is an automated email from the ASF dual-hosted git repository.
morningman 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 3b00ba0811c [Fix](outfile) Fix the timing of setting the _is_closed
flag in Parquet/ORC writer (#34668)
3b00ba0811c is described below
commit 3b00ba0811c3d56d4ebc1ba1fdda020f5e2e1579
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 7cd5b9ad10d..30198f8f7cd 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]