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

   Emmm would you mind check `poRecordBatchReader->ReadNext` and break when 
detect error? I try the code below and it still not leak:
   
   ```
     std::unique_ptr<parquet::arrow::FileReader> arrow_reader;
     ARROW_ASSIGN_OR_RAISE(arrow_reader, reader_builder.Build());
   
     std::shared_ptr<::arrow::RecordBatchReader> rb_reader;
     ARROW_RETURN_NOT_OK(arrow_reader->GetRecordBatchReader(&rb_reader));
   
     for (arrow::Result<std::shared_ptr<arrow::RecordBatch>> maybe_batch : 
*rb_reader) {
       // Operate on each batch...
       if (!maybe_batch.ok()) {
         std::cout << "Error reading batch: " << maybe_batch.status().message() 
<< std::endl;
       } else {
         std::shared_ptr<arrow::RecordBatch> batch = maybe_batch.ValueOrDie();
         std::cout << "Read batch with " << batch->num_rows() << " rows" << 
std::endl;
       }
     }
   ```


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