-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BugFix] Fix arrow parquet exception handling (#25621)
Fixes #23606, where memory leaks are introduced by `_chunk_writer->release()` The modification on Arrow is to make sure `RowGroupSerializer::column_writers_` is cleaned up even if exception throws. You may refer apache/arrow#35520 for more details. Signed-off-by: Letian Jiang <[email protected]>
- Loading branch information
1 parent
c1a3351
commit f610fdf
Showing
3 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
thirdparty/patches/arrow-5.0.0-fix-exception-handling.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/cpp/src/parquet/file_writer.cc b/cpp/src/parquet/file_writer.cc | ||
index deac9586e..836f9e93c 100644 | ||
--- a/cpp/src/parquet/file_writer.cc | ||
+++ b/cpp/src/parquet/file_writer.cc | ||
@@ -181,15 +181,13 @@ class RowGroupSerializer : public RowGroupWriter::Contents { | ||
closed_ = true; | ||
CheckRowsWritten(); | ||
|
||
+ auto column_writers = std::move(column_writers_); | ||
for (size_t i = 0; i < column_writers_.size(); i++) { | ||
if (column_writers_[i]) { | ||
total_bytes_written_ += column_writers_[i]->Close(); | ||
- column_writers_[i].reset(); | ||
} | ||
} | ||
|
||
- column_writers_.clear(); | ||
- | ||
// Ensures all columns have been written | ||
metadata_->set_num_rows(num_rows_); | ||
metadata_->Finish(total_bytes_written_, row_group_ordinal_); |