Tom-Newton commented on code in PR #38505:
URL: https://github.com/apache/arrow/pull/38505#discussion_r1383022587
##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -317,27 +321,136 @@ class ObjectInputFile final : public
io::RandomAccessFile {
class AzureFileSystem::Impl {
public:
io::IOContext io_context_;
- std::shared_ptr<Azure::Storage::Blobs::BlobServiceClient> service_client_;
+ std::shared_ptr<Azure::Storage::Files::DataLake::DataLakeServiceClient>
+ datalake_service_client_;
+ std::shared_ptr<Azure::Storage::Blobs::BlobServiceClient>
blob_service_client_;
AzureOptions options_;
+ internal::HierarchicalNamespaceDetector hierarchical_namespace_;
explicit Impl(AzureOptions options, io::IOContext io_context)
: io_context_(io_context), options_(std::move(options)) {}
Status Init() {
- service_client_ =
std::make_shared<Azure::Storage::Blobs::BlobServiceClient>(
+ blob_service_client_ =
std::make_shared<Azure::Storage::Blobs::BlobServiceClient>(
options_.account_blob_url, options_.storage_credentials_provider);
+ datalake_service_client_ =
+
std::make_shared<Azure::Storage::Files::DataLake::DataLakeServiceClient>(
+ options_.account_dfs_url, options_.storage_credentials_provider);
+ RETURN_NOT_OK(hierarchical_namespace_.Init(datalake_service_client_));
return Status::OK();
}
const AzureOptions& options() const { return options_; }
+ public:
+ Result<FileInfo> GetFileInfo(const AzurePath& path) {
+ FileInfo info;
+ info.set_path(path.full_path);
+
+ if (path.container.empty()) {
+ DCHECK(path.path_to_file.empty()); // The path is invalid if the
container is empty
+ // but not path_to_file.
+ // path must refer to the root of the Azure storage account. This is a
directory,
+ // and there isn't any extra metadata to fetch.
+ return FileInfo(path.full_path, FileType::Directory);
Review Comment:
Oops
##########
cpp/src/arrow/filesystem/path_util.cc:
##########
@@ -191,12 +191,19 @@ std::string_view RemoveLeadingSlash(std::string_view key)
{
}
Status AssertNoTrailingSlash(std::string_view key) {
- if (key.back() == '/') {
+ if (HasTrailingSlash(key)) {
return NotAFile(key);
}
return Status::OK();
}
+bool HasTrailingSlash(std::string_view key) {
+ if (key.back() != '/') {
+ return false;
+ }
+ return true;
Review Comment:
:+1: I will make the change to `HasLeadingSlash()` too. (I was thinking the
same but chose to copy `HasLeadingSlash()`)
--
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]