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

Method CreateHierarchy

cpp/src/arrow/filesystem/gcsfs_test.cc:215–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

213 };
214
215 Result<Hierarchy> CreateHierarchy(std::shared_ptr<arrow::fs::FileSystem> fs) {
216 const char* const kTestFolders[] = {
217 "b",
218 "b/0",
219 "b/0/0",
220 "b/1",
221 "b/2",
222 // Create some additional folders that should not appear in any listing of b/
223 "aa",
224 "ba",
225 "c",
226 };
227 constexpr auto kFilesPerFolder = 2;
228 auto base_dir = internal::ConcatAbstractPath(PreexistingBucketPath(), "b");
229 auto result = Hierarchy{base_dir, {}};
230 for (const auto* f : kTestFolders) {
231 const auto folder = internal::ConcatAbstractPath(PreexistingBucketPath(), f);
232 RETURN_NOT_OK(fs->CreateDir(folder, true));
233 result.contents.push_back(arrow::fs::Dir(folder));
234 for (int i = 0; i != kFilesPerFolder; ++i) {
235 const auto filename =
236 internal::ConcatAbstractPath(folder, "test-file-" + std::to_string(i));
237 CreateFile(fs.get(), filename, filename);
238 ARROW_ASSIGN_OR_RAISE(auto file_info, fs->GetFileInfo(filename));
239 result.contents.push_back(std::move(file_info));
240 }
241 }
242 return result;
243 }
244
245 // Directories must appear without a trailing slash in the results.
246 std::vector<arrow::fs::FileInfo> static CleanupDirectoryNames(

Callers

nothing calls this directly

Calls 7

ConcatAbstractPathFunction · 0.85
DirFunction · 0.85
to_stringFunction · 0.85
CreateFileFunction · 0.85
push_backMethod · 0.80
CreateDirMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected