MCPcopy Create free account
hub / github.com/apache/arrow / GetFileInfo

Method GetFileInfo

cpp/src/arrow/filesystem/hdfs.cc:154–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 8

IOErrorFunction · 0.85
StatSelectorFunction · 0.85
substrMethod · 0.80
backMethod · 0.80
InvalidFunction · 0.50
emptyMethod · 0.45
findMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected