mapleFU commented on PR #38390:
URL: https://github.com/apache/arrow/pull/38390#issuecomment-1787550666

   Oh previously I approve because the change looks ok to me, but after 
re-review I found the reason for re-close.
   
   ```C++
     Status NewRowGroup(int64_t chunk_size) override {
       if (row_group_writer_ != nullptr) {
         PARQUET_CATCH_NOT_OK(row_group_writer_->Close());
       }
       PARQUET_CATCH_NOT_OK(row_group_writer_ = writer_->AppendRowGroup());
       return Status::OK();
     }
   
     Status Close() override {
       if (!closed_) {
         // Make idempotent
         closed_ = true;
         if (row_group_writer_ != nullptr) {
           PARQUET_CATCH_NOT_OK(row_group_writer_->Close());
         }
         PARQUET_CATCH_NOT_OK(writer_->Close());
       }
       return Status::OK();
     }
   ```
   
   Also I think the `re-close` is like:
   
   ```c++
   Close();
   NewRowGroupWriter();
   ```
   
   in `parquet::arrow::FileWriter`. And
   
   1. `Close` -> `row_group_writer_->Close()` called once without cleaning 
`closed_`
   2. `NewRowGroupWriter()` -> find `row_group_writer_ != nullptr`, and close 
it.
   
   Solving: You can also add a `CheckClosed` like 
https://github.com/apache/arrow/pull/38390#issuecomment-1774119222 here.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to