mapleFU commented on issue #38117:
URL: https://github.com/apache/arrow/issues/38117#issuecomment-1751740630

   @pitrou I've draft a basic fixing for this 
https://github.com/apache/arrow/pull/38118
   
   I change `DCHECK` to `ARROW_LOG(WARNING)`. This might not the best, because 
it might cause user forget to flush the `DictEncoder`. Another way is provide 
an `abort`.
   
   ```
         // Avoid invalid state if ColumnWriter::Close() throws internally.
         auto column_writers = std::move(column_writers_);
         for (size_t i = 0; i < column_writers.size(); i++) {
           if (column_writers[i]) {
              column_writers[i]->abort(); // abort might not throw exception.
           }
         }
         for (size_t i = 0; i < column_writers.size(); i++) {
           if (column_writers[i]) {
             total_bytes_written_ += column_writers[i]->Close();
             ...
           }
         }
   ```
   
   And change `DCHECK` to:
   
   ```c++
   DCHECK(aborted_ || !buffered_indices_.empty());
   ```
   
   Any idea is ok for me :-)


-- 
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