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/04/12 17:50:36 UTC

[GitHub] [arrow] pitrou commented on a change in pull request #9949: ARROW-6248: [Python][C++] Raise better exception on HDFS file open error

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



##########
File path: cpp/src/arrow/io/hdfs.cc
##########
@@ -497,12 +501,15 @@ class HadoopFileSystem::HadoopFileSystemImpl {
   Status OpenReadable(const std::string& path, int32_t buffer_size,
                       const io::IOContext& io_context,
                       std::shared_ptr<HdfsReadableFile>* file) {
+    errno = 0;
     hdfsFile handle = driver_->OpenFile(fs_, path.c_str(), O_RDONLY, buffer_size, 0, 0);
 
     if (handle == nullptr) {
-      const char* msg = !Exists(path) ? "HDFS file does not exist: "
-                                      : "HDFS path exists, but opening file failed: ";
-      return Status::IOError(msg, path);
+      if (errno) {

Review comment:
       This is the pseudo-magic C `errno` variable :-)
   See https://pubs.opengroup.org/onlinepubs/9699919799/functions/errno.html, https://en.cppreference.com/w/c/error/errno




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

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