kou commented on issue #41990:
URL: https://github.com/apache/arrow/issues/41990#issuecomment-2156266085

   Ah, using `std::unique_ptr<Impl>&&` in `azurefs.h` may be a problem.
   
   Could you try this?
   
   ```diff
   diff --git a/cpp/src/arrow/filesystem/azurefs.cc 
b/cpp/src/arrow/filesystem/azurefs.cc
   index bb8309a247..b4975a3098 100644
   --- a/cpp/src/arrow/filesystem/azurefs.cc
   +++ b/cpp/src/arrow/filesystem/azurefs.cc
   @@ -1398,19 +1398,14 @@ class AzureFileSystem::Impl {
      std::unique_ptr<Blobs::BlobServiceClient> blob_service_client_;
      HNSSupport cached_hns_support_ = HNSSupport::kUnknown;
    
   + public:
      Impl(AzureOptions options, io::IOContext io_context)
          : io_context_(std::move(io_context)), options_(std::move(options)) {}
    
   - public:
   -  static Result<std::unique_ptr<AzureFileSystem::Impl>> Make(AzureOptions 
options,
   -                                                             io::IOContext 
io_context) {
   -    auto self = std::unique_ptr<AzureFileSystem::Impl>(
   -        new AzureFileSystem::Impl(std::move(options), 
std::move(io_context)));
   -    ARROW_ASSIGN_OR_RAISE(self->blob_service_client_,
   -                          self->options_.MakeBlobServiceClient());
   -    ARROW_ASSIGN_OR_RAISE(self->datalake_service_client_,
   -                          self->options_.MakeDataLakeServiceClient());
   -    return self;
   +  Status Init() {
   +    ARROW_ASSIGN_OR_RAISE(blob_service_client_, 
options_.MakeBlobServiceClient());
   +    ARROW_ASSIGN_OR_RAISE(datalake_service_client_, 
options_.MakeDataLakeServiceClient());
   +    return Status::OK();
      }
    
      io::IOContext& io_context() { return io_context_; }
   @@ -2893,19 +2888,23 @@ class AzureFileSystem::Impl {
    std::atomic<LeaseGuard::SteadyClock::time_point> 
LeaseGuard::latest_known_expiry_time_ =
        SteadyClock::time_point{SteadyClock::duration::zero()};
    
   -AzureFileSystem::AzureFileSystem(std::unique_ptr<Impl>&& impl)
   -    : FileSystem(impl->io_context()), impl_(std::move(impl)) {
   +AzureFileSystem::AzureFileSystem(const AzureOptions& options,
   +                                 const io::IOContext& io_context)
   +    : FileSystem(io_context), impl_(std::make_unique<Impl>(options, 
io_context)) {
      default_async_is_sync_ = false;
    }
    
   +Status AzureFileSystem::Init() { return impl_->Init(); }
   +
    void AzureFileSystem::ForceCachedHierarchicalNamespaceSupport(int 
hns_support) {
      impl_->ForceCachedHierarchicalNamespaceSupport(hns_support);
    }
    
    Result<std::shared_ptr<AzureFileSystem>> AzureFileSystem::Make(
        const AzureOptions& options, const io::IOContext& io_context) {
   -  ARROW_ASSIGN_OR_RAISE(auto impl, AzureFileSystem::Impl::Make(options, 
io_context));
   -  return std::shared_ptr<AzureFileSystem>(new 
AzureFileSystem(std::move(impl)));
   +  std::shared_ptr<AzureFileSystem> filesystem(new AzureFileSystem(options, 
io_context));
   +  ARROW_RETURN_NOT_OK(filesystem->Init());
   +  return filesystem;
    }
    
    const AzureOptions& AzureFileSystem::options() const { return 
impl_->options(); }
   diff --git a/cpp/src/arrow/filesystem/azurefs.h 
b/cpp/src/arrow/filesystem/azurefs.h
   index 350014954f..2f6ecb53a1 100644
   --- a/cpp/src/arrow/filesystem/azurefs.h
   +++ b/cpp/src/arrow/filesystem/azurefs.h
   @@ -232,7 +232,8 @@ class ARROW_EXPORT AzureFileSystem : public FileSystem {
      class Impl;
      std::unique_ptr<Impl> impl_;
    
   -  explicit AzureFileSystem(std::unique_ptr<Impl>&& impl);
   +  explicit AzureFileSystem(const AzureOptions& options, const 
io::IOContext& io_context);
   +  Status Init();
    
      friend class TestAzureFileSystem;
      void ForceCachedHierarchicalNamespaceSupport(int hns_support);
   ```


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