felipecrv commented on code in PR #40119:
URL: https://github.com/apache/arrow/pull/40119#discussion_r1495988919
##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -1662,20 +1705,28 @@ class AzureFileSystem::Impl {
AzureFileSystem* fs) {
RETURN_NOT_OK(ValidateFileLocation(location));
+ const auto blob_container_client =
GetBlobContainerClient(location.container);
auto block_blob_client = std::make_shared<Blobs::BlockBlobClient>(
- blob_service_client_->GetBlobContainerClient(location.container)
- .GetBlockBlobClient(location.path));
+ blob_container_client.GetBlockBlobClient(location.path));
+
+ auto ensure_not_flat_namespace_directory = [this, location,
+ blob_container_client]() ->
Status {
+ bool hierarchical_namespace_enabled =
+
HierarchicalNamespaceSupport(GetFileSystemClient(location.container)) ==
+ HNSSupport::kEnabled;
Review Comment:
It could be `HNSSupport::kContainerNotFound`.
You can be explicit
```cpp
ARROW_ASSIGN_OR_RAISE(auto hns_support,
HierarchicalNamespaceSupport(adlfs_client));
if (hns_support == HNSSupport::kContainerNotFound) {
return Status::OK();
}
if (hns_support == HNSSupport::kDisabled) {
// handle HNS disabled case
}
return Status::OK();
```
or compare with `HNSSupport::kDisabled` (`!(hns_suppport == kEnabled)` is
not equivalent to `hns_support == kDisabled`).
```cpp
ARROW_ASSIGN_OR_RAISE(auto hns_support,
HierarchicalNamespaceSupport(adlfs_client));
if (hns_support == HNSSupport::kDisabled) {
// check
}
return Status::OK();
```
##########
cpp/src/arrow/filesystem/azurefs.cc:
##########
@@ -716,17 +738,31 @@ class ObjectAppendStream final : public io::OutputStream {
io::internal::CloseFromDestructor(this);
}
- Status Init() {
- if (content_length_ != kNoSize) {
- DCHECK_GE(content_length_, 0);
- pos_ = content_length_;
+ Status Init(const bool truncate,
+ std::function<Status()> ensure_not_flat_namespace_directory) {
Review Comment:
You can inject `AzureFileSystem *azure_file_system` here and not have to
allocate a closure for this. You would call
`AzureFileSystem::Impl::EnsureNotFlatNamespaceDirectory(location)` via
`azure_file_system->impl_` (accessible because the handles produced by the
azure file system can be friends with the filesystem class).
--
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]