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

Function IsAncestorOf

cpp/src/arrow/dataset/subtree_test.cc:108–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 return key;
107}
108bool IsAncestorOf(std::string_view ancestor, std::string_view descendant) {
109 // See filesystem/path_util.h
110 ancestor = RemoveTrailingSlash(ancestor);
111 if (ancestor == "") return true;
112 descendant = RemoveTrailingSlash(descendant);
113 if (!descendant.starts_with(ancestor)) return false;
114 descendant.remove_prefix(ancestor.size());
115 if (descendant.empty()) return true;
116 return descendant.front() == '/';
117}
118
119Forest MakeForest(std::vector<FileInfo>* infos) {
120 std::sort(infos->begin(), infos->end(), FileInfo::ByPath);

Callers 1

MakeForestFunction · 0.70

Calls 3

RemoveTrailingSlashFunction · 0.70
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected