emkornfield commented on code in PR #12763:
URL: https://github.com/apache/arrow/pull/12763#discussion_r855340698


##########
cpp/src/arrow/filesystem/gcsfs.cc:
##########
@@ -156,17 +166,24 @@ class GcsInputStream : public arrow::io::InputStream {
   mutable gcs::ObjectReadStream stream_;
   GcsPath path_;
   gcs::Generation generation_;
-  std::int64_t offset_;
   gcs::Client client_;
   bool closed_ = false;
 };
 
 class GcsOutputStream : public arrow::io::OutputStream {
  public:
   explicit GcsOutputStream(gcs::ObjectWriteStream stream) : 
stream_(std::move(stream)) {}
-  ~GcsOutputStream() override = default;
+  ~GcsOutputStream() {
+    if (!closed_) {
+      // The common pattern is to close OutputStreams from destructor in arrow.
+      io::internal::CloseFromDestructor(this);
+    }
+  }
 
   Status Close() override {
+    if (closed_) {
+      return Status::Invalid("Already closed stream.");

Review Comment:
   done.



-- 
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-unsubscr...@arrow.apache.org

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

Reply via email to