diff --git a/rust/lance-io/src/object_store/providers.rs b/rust/lance-io/src/object_store/providers.rs index 3ac6be93d6f..a8d4d328b5d 100644 --- a/rust/lance-io/src/object_store/providers.rs +++ b/rust/lance-io/src/object_store/providers.rs @@ -235,7 +235,11 @@ impl Default for ObjectStoreRegistry { providers.insert("s3+ddb".into(), aws); } #[cfg(feature = "azure")] - providers.insert("az".into(), Arc::new(azure::AzureBlobStoreProvider)); + { + let azure = Arc::new(azure::AzureBlobStoreProvider); + providers.insert("az".into(), azure.clone()); + providers.insert("https".into(), azure); + } #[cfg(feature = "gcp")] providers.insert("gs".into(), Arc::new(gcp::GcsStoreProvider)); #[cfg(feature = "oss")] diff --git a/rust/lance-io/src/object_store/providers/azure.rs b/rust/lance-io/src/object_store/providers/azure.rs index b79ca8498d0..8c5ed1c2ac6 100644 --- a/rust/lance-io/src/object_store/providers/azure.rs +++ b/rust/lance-io/src/object_store/providers/azure.rs @@ -10,6 +10,7 @@ use snafu::location; use object_store::{ azure::{AzureConfigKey, MicrosoftAzureBuilder}, + path::Path, RetryConfig, }; use url::Url; @@ -87,6 +88,20 @@ impl AzureBlobStoreProvider { #[async_trait::async_trait] impl ObjectStoreProvider for AzureBlobStoreProvider { + fn extract_path(&self, url: &Url) -> Result { + // Azure https paths in ObjectSore encode the container name as the first path segment. + // The actual object path starts from the second segment. + if url.scheme() == "https" { + url.path_segments() + .map(|s| Path::from_iter(s.skip(1))) + .ok_or_else(|| { + Error::invalid_input(format!("Invalid Azure URL: {url}"), location!()) + }) + } else { + Ok(Path::from(url.path())) + } + } + async fn new_store(&self, base_path: Url, params: &ObjectStoreParams) -> Result { let block_size = params.block_size.unwrap_or(DEFAULT_CLOUD_BLOCK_SIZE); let mut storage_options = @@ -164,6 +179,16 @@ mod tests { assert_eq!(path, expected_path); } + #[test] + fn test_azure_store_https_path() { + let provider = AzureBlobStoreProvider; + + let url = Url::parse("https://account.blob.core.windows.net/bucket/path/to/file").unwrap(); + let path = provider.extract_path(&url).expect("Failed to extract path"); + let expected_path = object_store::path::Path::from("path/to/file"); + assert_eq!(path, expected_path); + } + #[tokio::test] async fn test_use_opendal_flag() { let provider = AzureBlobStoreProvider;