Apache DataFusion SQL Query Engine
The returned path value of get_by_uri should be self-described with entire path (#1779)
yahoNanJing7a460844f0d8
diff --git a/datafusion/src/datasource/object_store/local.rs b/datafusion/src/datasource/object_store/local.rsindex d46be4a5c5..edfe5e2cec 100644--- a/datafusion/src/datasource/object_store/local.rs+++ b/datafusion/src/datasource/object_store/local.rs@@ -39,6 +39,11 @@ pub struct LocalFileSystem;#[async_trait]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}diff --git a/datafusion/src/datasource/object_store/mod.rs b/datafusion/src/datasource/object_store/mod.rsindex 24bdaab55a..aad70e70a3 100644--- a/datafusion/src/datasource/object_store/mod.rs+++ b/datafusion/src/datasource/object_store/mod.rs@@ -220,13 +220,12 @@ impl ObjectStoreRegistry {/// Get a suitable store for the URI based on it's scheme. For example:/// - URI with scheme `file://` or no schema will return the default LocalFS store/// - URI with scheme `s3://` will return the S3 store if it's registered- /// Returns a tuple with the store and the path of the file in that store- /// (URI=scheme://path).+ /// Returns a tuple with the store and the self-described uri of the file in that storepub fn get_by_uri<'a>(&self,uri: &'a str,) -> Result<(Arc<dyn ObjectStore>, &'a str)> {- if let Some((scheme, path)) = uri.split_once("://") {+ if let Some((scheme, _path)) = uri.split_once("://") {let stores = self.object_stores.read();let store = stores.get(&*scheme.to_lowercase())@@ -237,7 +236,7 @@ impl ObjectStoreRegistry {scheme))})?;- Ok((store, path))+ Ok((store, uri))} else {Ok((Arc::new(LocalFileSystem), uri))}