You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "wgtmac (via GitHub)" <gi...@apache.org> on 2023/05/10 07:37:59 UTC

[GitHub] [arrow] wgtmac commented on a diff in pull request #35520: GH-35519: [C++][Parquet] Fixing exception handling in parquet FileSerializer

wgtmac commented on code in PR #35520:
URL: https://github.com/apache/arrow/pull/35520#discussion_r1189477737


##########
cpp/src/parquet/file_writer.cc:
##########
@@ -219,17 +219,17 @@ class RowGroupSerializer : public RowGroupWriter::Contents {
       closed_ = true;
       CheckRowsWritten();
 
-      for (size_t i = 0; i < column_writers_.size(); i++) {
-        if (column_writers_[i]) {
-          total_bytes_written_ += column_writers_[i]->Close();
+      // If ColumnWriter::Close thrown an exception, avoid
+      // have bad states in column_writers_.

Review Comment:
   ```suggestion
         // Avoid invalid state if ColumnWriter::Close() throws internally.
   ```



##########
cpp/src/parquet/file_writer.cc:
##########
@@ -219,17 +219,17 @@ class RowGroupSerializer : public RowGroupWriter::Contents {
       closed_ = true;
       CheckRowsWritten();
 
-      for (size_t i = 0; i < column_writers_.size(); i++) {
-        if (column_writers_[i]) {
-          total_bytes_written_ += column_writers_[i]->Close();
+      // If ColumnWriter::Close thrown an exception, avoid
+      // have bad states in column_writers_.

Review Comment:
   If anything wrong happens here, should we let the FileSerializer know that it cannot accept any write any more?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org