felipecrv commented on code in PR #39361:
URL: https://github.com/apache/arrow/pull/39361#discussion_r1442103774


##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -1404,11 +1428,76 @@ class AzureFileSystem::Impl {
     return stream;
   }
 
- private:
-  Status DeleteDirContentsWithoutHierarchicalNamespace(const AzureLocation& 
location,
-                                                       bool missing_dir_ok) {
-    auto container_client =
-        blob_service_client_->GetBlobContainerClient(location.container);
+  /// This function assumes the container already exists. So it can only be
+  /// called after that has been verified.
+  ///
+  /// \pre location.container is not empty.
+  /// \pre The location.container container already exists.
+  Status EnsureEmptyDirExists(const Blobs::BlobContainerClient& 
container_client,
+                              const AzureLocation& location) {
+    DCHECK(!location.container.empty());
+    if (location.path.empty()) {
+      // Nothing to do. The container already exists per the preconditions.
+      return Status::OK();
+    }
+    auto dir_marker_blob_path = internal::EnsureTrailingSlash(location.path);
+    auto block_blob_client =
+        
container_client.GetBlobClient(dir_marker_blob_path).AsBlockBlobClient();
+    try {
+      block_blob_client.UploadFrom(nullptr, 0);
+      return Status::OK();
+    } catch (const Storage::StorageException& exception) {
+      return ExceptionToStatus(exception);

Review Comment:
   Fix coming.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to