This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new ccf8be8f2c4 [Fix](outfile) Fix the timing of setting the _is_closed
flag in Parquet/ORC writer (#34669)
ccf8be8f2c4 is described below
commit ccf8be8f2c4c6ed71d9f92990c7593029f191d80
Author: Tiewei Fang <[email protected]>
AuthorDate: Thu May 16 20:23:35 2024 +0800
[Fix](outfile) Fix the timing of setting the _is_closed flag in Parquet/ORC
writer (#34669)
backport: #34668
---
be/src/vec/runtime/vorc_writer.cpp | 2 +-
be/src/vec/runtime/vparquet_writer.cpp | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/be/src/vec/runtime/vorc_writer.cpp
b/be/src/vec/runtime/vorc_writer.cpp
index c719268c9b8..dff2d3da75b 100644
--- a/be/src/vec/runtime/vorc_writer.cpp
+++ b/be/src/vec/runtime/vorc_writer.cpp
@@ -69,8 +69,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_writer.cpp
b/be/src/vec/runtime/vparquet_writer.cpp
index 8d986dac326..b5f73e2ca18 100644
--- a/be/src/vec/runtime/vparquet_writer.cpp
+++ b/be/src/vec/runtime/vparquet_writer.cpp
@@ -98,15 +98,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();
}
@@ -942,6 +941,7 @@ int64_t VParquetWriterWrapper::written_len() {
Status VParquetWriterWrapper::close() {
try {
if (_rg_writer != nullptr) {
+ LOG(INFO) << "--ftw: _rg_writer->Close()";
_rg_writer->Close();
_rg_writer = nullptr;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]