From 0e7e966a52d14552c14523d73b1ea1439955d4d1 Mon Sep 17 00:00:00 2001 From: Thomas Newton Date: Fri, 4 Oct 2024 16:57:33 +0100 Subject: [PATCH] Fix GetFileInfoWithSelectorFromFileSystem on root of container --- cpp/src/arrow/filesystem/azurefs.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/filesystem/azurefs.cc b/cpp/src/arrow/filesystem/azurefs.cc index 5a63d5c31895c..44bed275ab5d2 100644 --- a/cpp/src/arrow/filesystem/azurefs.cc +++ b/cpp/src/arrow/filesystem/azurefs.cc @@ -1929,15 +1929,18 @@ class AzureFileSystem::Impl { /// \brief List the paths at the root of a filesystem or some dir in a filesystem. /// /// \pre adlfs_client is the client for the filesystem named like the first - /// segment of select.base_dir. + /// segment of select.base_dir. The filesystem is know to exist. Status GetFileInfoWithSelectorFromFileSystem( const DataLake::DataLakeFileSystemClient& adlfs_client, const Core::Context& context, Azure::Nullable page_size_hint, const FileSelector& select, FileInfoVector* acc_results) { ARROW_ASSIGN_OR_RAISE(auto base_location, AzureLocation::FromString(select.base_dir)); + // The filesystem a.k.a. the container is known to exist so if the path is empty then + // we have already found the base_location, so initialize found to true. + bool found = base_location.path.empty(); + auto directory_client = adlfs_client.GetDirectoryClient(base_location.path); - bool found = false; DataLake::ListPathsOptions options; options.PageSizeHint = page_size_hint;