You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/20 11:55:03 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #11976: ARROW-15115: [C++] GcsFileSystem return errors if using closed streams

pitrou commented on a change in pull request #11976:
URL: https://github.com/apache/arrow/pull/11976#discussion_r772304739



##########
File path: cpp/src/arrow/filesystem/gcsfs.cc
##########
@@ -96,28 +96,29 @@ class GcsInputStream : public arrow::io::InputStream {
   // @name FileInterface
   Status Close() override {
     stream_.Close();
+    closed_ = true;
     return Status::OK();
   }
 
   Result<int64_t> Tell() const override {
-    if (!stream_) {
-      return Status::IOError("invalid stream");
-    }
+    if (closed()) return Status::Invalid("Cannot use Tell() on a closed stream");
     return stream_.tellg() + offset_;
   }
 
-  bool closed() const override { return !stream_.IsOpen(); }
+  bool closed() const override { return closed_ && !stream_.IsOpen(); }

Review comment:
       Is there a reason this is `&&` rather than `||`?




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

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