kou commented on code in PR #38708:
URL: https://github.com/apache/arrow/pull/38708#discussion_r1396670968


##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -611,6 +621,109 @@ class AzureFileSystem::Impl {
     RETURN_NOT_OK(ptr->Init());
     return ptr;
   }
+
+  Status CreateDir(const AzurePath& path) {
+    if (path.container.empty()) {
+      return Status::Invalid("Cannot create an empty container");
+    }
+
+    if (path.path_to_file.empty()) {
+      auto container_client =
+          blob_service_client_->GetBlobContainerClient(path.container);
+      try {
+        auto response = container_client.Create();
+        if (response.Value.Created) {
+          return Status::OK();
+        } else {
+          return StatusFromErrorResponse(
+              container_client.GetUrl(), response.RawResponse.get(),
+              "Failed to create a container: " + path.container);
+        }
+      } catch (const Azure::Storage::StorageException& exception) {
+        return internal::ExceptionToStatus(
+            "Failed to create a container: " + path.container + ": " +
+                container_client.GetUrl(),
+            exception);
+      }
+    }
+
+    ARROW_ASSIGN_OR_RAISE(auto hierarchical_namespace_enabled,
+                          hierarchical_namespace_.Enabled(path.container));
+    if (!hierarchical_namespace_enabled) {
+      // We can't create a directory without hierarchical namespace
+      // support. There is only "virtual directory" without
+      // hierarchical namespace support. And a "virtual directory" is
+      // (virtually) created a blob with ".../.../blob" blob name
+      // automatically.

Review Comment:
   Thanks for the suggestion!
   I'll use the suggested wording!



-- 
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