Skip to content

Commit c7009ac

Browse files
sebbeggrtyler
authored andcommitted
support abfss urls
1 parent 515f3d7 commit c7009ac

File tree

1 file changed

+11
-1
lines changed
  • crates/core/src/logstore

1 file changed

+11
-1
lines changed

crates/core/src/logstore/mod.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,17 @@ pub(crate) fn get_engine(store: Arc<dyn ObjectStore>) -> Arc<dyn Engine> {
496496
#[cfg(feature = "datafusion")]
497497
fn object_store_url(location: &Url) -> ObjectStoreUrl {
498498
use object_store::path::DELIMITER;
499+
500+
// azure storage urls encode the container as user in the url
501+
let user_at = match location.username() {
502+
u if !u.is_empty() => format!("{u}@"),
503+
_ => "".to_string(),
504+
};
505+
499506
ObjectStoreUrl::parse(format!(
500-
"delta-rs://{}-{}{}",
507+
"delta-rs://{}-{}{}{}",
501508
location.scheme(),
509+
user_at,
502510
location.host_str().unwrap_or("-"),
503511
location.path().replace(DELIMITER, "-").replace(':', "-")
504512
))
@@ -975,6 +983,8 @@ mod datafusion_tests {
975983
("s3://my_bucket/path/to/table_1", "file:///path/to/table_1"),
976984
// Same scheme, different host, same path
977985
("s3://bucket_1/table_1", "s3://bucket_2/table_1"),
986+
// Azure urls should encode the container
987+
("abfss://container1@host/table_1", "abfss://container2@host/table_1"),
978988
] {
979989
let url_1 = Url::parse(location_1).unwrap();
980990
let url_2 = Url::parse(location_2).unwrap();

0 commit comments

Comments
 (0)