lidavidm commented on code in PR #13205:
URL: https://github.com/apache/arrow/pull/13205#discussion_r886705401


##########
cpp/src/arrow/dataset/scanner.cc:
##########
@@ -85,6 +92,15 @@ class ScannerRecordBatchReader : public RecordBatchReader {
     return Status::OK();
   }
 
+  Status Close() override {
+    std::shared_ptr<RecordBatch> batch;
+    RETURN_NOT_OK(ReadNext(&batch));
+    while (batch != nullptr) {
+      RETURN_NOT_OK(ReadNext(&batch));
+    }
+    return Status::OK();

Review Comment:
   I wonder if this should just be made the default implementation?



##########
cpp/src/arrow/dataset/scanner.cc:
##########
@@ -74,6 +74,13 @@ class ScannerRecordBatchReader : public RecordBatchReader {
                                     TaggedRecordBatchIterator delegate)
       : schema_(std::move(schema)), delegate_(std::move(delegate)) {}
 
+  ~ScannerRecordBatchReader() {
+    auto st = this->Close();
+    if (!st.ok()) {
+      ARROW_LOG(WARNING) << "ScannerRecordBatchReader failed in finalzing 
reading.";

Review Comment:
   Is there any need to override the destructor here? Also this error message 
is less informative than the one on the base class.



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