Tom-Newton commented on code in PR #38269:
URL: https://github.com/apache/arrow/pull/38269#discussion_r1364483043


##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -37,34 +43,330 @@ bool AzureOptions::Equals(const AzureOptions& other) const 
{
           credentials_kind == other.credentials_kind);
 }
 
+Status AzureOptions::ConfigureAccountKeyCredentials(const std::string& 
account_name,
+                                                    const std::string& 
account_key) {
+  if (this->backend == AzureBackend::Azurite) {
+    account_blob_url = "http://127.0.0.1:10000/"; + account_name + "/";
+    account_dfs_url = "http://127.0.0.1:10000/"; + account_name + "/";
+  } else {
+    account_dfs_url = "https://"; + account_name + ".dfs.core.windows.net/";
+    account_blob_url = "https://"; + account_name + ".blob.core.windows.net/";
+  }
+  storage_credentials_provider =
+      
std::make_shared<Azure::Storage::StorageSharedKeyCredential>(account_name,
+                                                                   
account_key);
+  credentials_kind = AzureCredentialsKind::StorageCredentials;
+  return Status::OK();
+}
+namespace {
+
+// An AzureFileSystem represents a single Azure storage account. AzurePath 
describes a
+// container and path within that storage account.
+struct AzurePath {
+  std::string full_path;
+  std::string container;
+  std::string path_to_file;
+  std::vector<std::string> path_to_file_parts;
+
+  static Result<AzurePath> FromString(const std::string& s) {
+    // Example expected string format: testcontainer/testdir/testfile.txt
+    // container = testcontainer
+    // path_to_file = testdir/testfile.txt
+    // path_to_file_parts = [testdir, testfile.txt]
+    if (internal::IsLikelyUri(s)) {
+      return Status::Invalid(
+          "Expected an Azure object path of the form 'container/path...', got 
a URI: '",
+          s, "'");
+    }
+    auto src = internal::RemoveTrailingSlash(s);
+    auto input_path = std::string(src.data());

Review Comment:
   Thanks for explaining. It makes sense and I'm glad you spotted it. I think 
this was originally added in #12914 as part of a conversion from a full URI to 
a path relative to the storage account. I saw 
https://github.com/apache/arrow/pull/11997 though, so I removed that feature. 
Which means `input_path` is indeed un-needed. 



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