| 152 | HdfsOptions options() const { return options_; } |
| 153 | |
| 154 | Result<FileInfo> GetFileInfo(const std::string& path) { |
| 155 | // It has unfortunately been a frequent logic error to pass URIs down |
| 156 | // to GetFileInfo (e.g. ARROW-10264). Unlike other filesystems, HDFS |
| 157 | // silently accepts URIs but returns different results than if given the |
| 158 | // equivalent in-filesystem paths. Instead of raising cryptic errors |
| 159 | // later, notify the underlying problem immediately. |
| 160 | if (path.substr(0, 5) == "hdfs:") { |
| 161 | return Status::Invalid("GetFileInfo must not be passed a URI, got: ", path); |
| 162 | } |
| 163 | FileInfo info; |
| 164 | HdfsPathInfo path_info; |
| 165 | auto status = GetPathInfoStatus(path, &path_info); |
| 166 | info.set_path(path); |
| 167 | if (status.IsIOError()) { |
| 168 | info.set_type(FileType::NotFound); |
| 169 | return info; |
| 170 | } |
| 171 | |
| 172 | PathInfoToFileInfo(path_info, &info); |
| 173 | return info; |
| 174 | } |
| 175 | |
| 176 | bool Exists(const std::string& path) { |
| 177 | // hdfsExists does not distinguish between RPC failure and the file not |