timvw opened a new issue, #2525:
URL: https://github.com/apache/arrow-datafusion/issues/2525

   **Describe the bug**
   object_store_registry.get_by_uri does not work as expected.
   
   **To Reproduce && Expected behavior**
   ```rust
       #[test]
       fn test_get_by_uri_s3() {
           let sut = ObjectStoreRegistry::default();
           sut.register_store("s3".to_string(), Arc::new(LocalFileSystem {}));
           let uri = "s3://bucket/key";
           let (_, path) = sut.get_by_uri(uri).unwrap();
           assert_eq!(path, "bucket/key");
       }
   
       #[test]
       fn test_get_by_uri_file() {
           let sut = ObjectStoreRegistry::default();
           let uri = "file:///bucket/key";
           let (_, path) = sut.get_by_uri(uri).unwrap();
           assert_eq!(path, "/bucket/key");
       }
   
       #[test]
       fn test_get_by_uri_local() {
           let sut = ObjectStoreRegistry::default();
           let uri = "/bucket/key";
           let (_, path) = sut.get_by_uri(uri).unwrap();
           assert_eq!(path, "/bucket/key");
       }
   ```
   
   **Additional context**
   This issue is not uncovered with local files, because LocalFileSystem does 
some additional "magic" to workaround the issue:
   
   ```rust
   impl ObjectStore for LocalFileSystem {
       async fn list_file(&self, prefix: &str) -> Result<FileMetaStream> {
           let prefix = if let Some((_scheme, path)) = prefix.split_once("://") 
{
               path
           } else {
               prefix
           };
           list_all(prefix.to_owned()).await
       }
   ```


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