This is an automated email from the ASF dual-hosted git repository.

westonpace pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new f959a2e05c GH-35635: [C++][CI] Preserve root when ignoring host on 
PathFromUriHelper to fix HDFS tests (#36063)
f959a2e05c is described below

commit f959a2e05c79351255227a91cb36d6ca39d01a3d
Author: Raúl Cumplido <[email protected]>
AuthorDate: Tue Jun 20 19:59:47 2023 +0200

    GH-35635: [C++][CI] Preserve root when ignoring host on PathFromUriHelper 
to fix HDFS tests (#36063)
    
    ### Rationale for this change
    
    As discussed on the issue the HDFS filesystem should be returning `/` if 
the entire path is `/`
    
    ### What changes are included in this PR?
    
    Change behavior of helper `PathFromUriHelper` when ignoring host to 
preserve `/`
    
    ### Are these changes tested?
    
    On CI and archery.
    
    ### Are there any user-facing changes?
    
    No
    * Closes: #35635
    
    Authored-by: Raúl Cumplido <[email protected]>
    Signed-off-by: Weston Pace <[email protected]>
---
 cpp/src/arrow/filesystem/util_internal.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpp/src/arrow/filesystem/util_internal.cc 
b/cpp/src/arrow/filesystem/util_internal.cc
index a2f34fb1bb..1ca5af27fc 100644
--- a/cpp/src/arrow/filesystem/util_internal.cc
+++ b/cpp/src/arrow/filesystem/util_internal.cc
@@ -180,7 +180,7 @@ Result<std::string> PathFromUriHelper(const std::string& 
uri_string,
     case AuthorityHandlingBehavior::kWindows:
       return std::string(internal::RemoveTrailingSlash("//" + host + path));
     case AuthorityHandlingBehavior::kIgnore:
-      return std::string(internal::RemoveTrailingSlash(path));
+      return std::string(internal::RemoveTrailingSlash(path, 
/*preserve_root=*/true));
     default:
       return Status::Invalid("Unrecognized authority_handling value");
   }

Reply via email to