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

Function StatSelector

cpp/src/arrow/filesystem/localfs.cc:196–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194#endif
195
196Status StatSelector(const PlatformFilename& dir_fn, const FileSelector& select,
197 int32_t nesting_depth, std::vector<FileInfo>* out) {
198 auto result = ListDir(dir_fn);
199 if (!result.ok()) {
200 auto status = result.status();
201 if (select.allow_not_found && status.IsIOError()) {
202 ARROW_ASSIGN_OR_RAISE(bool exists, FileExists(dir_fn));
203 if (!exists) {
204 return Status::OK();
205 }
206 }
207 return status;
208 }
209
210 for (const auto& child_fn : *result) {
211 PlatformFilename full_fn = dir_fn.Join(child_fn);
212 ARROW_ASSIGN_OR_RAISE(FileInfo info, StatFile(full_fn.ToNative()));
213 if (info.type() != FileType::NotFound) {
214 out->push_back(std::move(info));
215 }
216 if (nesting_depth < select.max_recursion && select.recursive &&
217 info.type() == FileType::Directory) {
218 RETURN_NOT_OK(StatSelector(full_fn, select, nesting_depth + 1, out));
219 }
220 }
221 return Status::OK();
222}
223
224} // namespace
225

Callers 3

GetFileInfoMethod · 0.85
StatSelectorMethod · 0.85
GetFileInfoMethod · 0.85

Calls 7

ListDirFunction · 0.85
push_backMethod · 0.80
OKFunction · 0.50
okMethod · 0.45
statusMethod · 0.45
JoinMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected