Skip to content

Commit 55ebeb3

Browse files
coryanpitrou
authored andcommitted
ARROW-14914: [C++] gcsfs will not implement DeleteRootDirContents
The function is too dangerous for GCS. Leave it unimplemented, with a message that explains why, and add a test. Closes #11829 from coryan/ARROW-14914-gcsfs-delete-root-dir-contents Authored-by: Carlos O'Ryan <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent b8431fb commit 55ebeb3

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎cpp/src/arrow/filesystem/gcsfs.cc‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,9 @@ Status GcsFileSystem::DeleteDirContents(const std::string& path) {
385385
}
386386

387387
Status GcsFileSystem::DeleteRootDirContents() {
388-
return Status::NotImplemented("The GCS FileSystem is not fully implemented");
388+
return Status::NotImplemented(
389+
std::string(__func__) +
390+
" is not implemented as it is too dangerous to delete all the buckets");
389391
}
390392

391393
Status GcsFileSystem::DeleteFile(const std::string& path) {

‎cpp/src/arrow/filesystem/gcsfs_test.cc‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ TEST_F(GcsIntegrationTest, GetFileInfoObject) {
342342
arrow::fs::AssertFileInfo(fs.get(), PreexistingObjectPath(), FileType::File);
343343
}
344344

345+
TEST_F(GcsIntegrationTest, DeleteRootDirContents) {
346+
auto fs = internal::MakeGcsFileSystemForTest(TestGcsOptions());
347+
EXPECT_RAISES_WITH_MESSAGE_THAT(NotImplemented, HasSubstr("too dangerous"),
348+
fs->DeleteRootDirContents());
349+
}
350+
345351
TEST_F(GcsIntegrationTest, DeleteFileSuccess) {
346352
auto fs = internal::MakeGcsFileSystemForTest(TestGcsOptions());
347353
ASSERT_OK(fs->DeleteFile(PreexistingObjectPath()));

0 commit comments

Comments
 (0)