Skip to content

Commit 1fb01af

Browse files
committed
fix: url parsing inconsistencies
Signed-off-by: Robert Pack <[email protected]>
1 parent a878029 commit 1fb01af

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

crates/core/src/logstore/config.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashMap;
22

33
use ::object_store::RetryConfig;
4-
use object_store::{path::Path, prefix::PrefixStore, ObjectStore};
4+
use object_store::{path::Path, prefix::PrefixStore, ObjectStore, ObjectStoreScheme};
55
use tokio::runtime::Handle;
66

77
#[cfg(feature = "delta-cache")]
@@ -141,18 +141,14 @@ impl StorageConfig {
141141
Ok(inner)
142142
}
143143

144-
fn decorate_prefix<T: ObjectStore>(
144+
pub(crate) fn decorate_prefix<T: ObjectStore>(
145145
store: T,
146146
table_root: &url::Url,
147147
) -> DeltaResult<Box<dyn ObjectStore>> {
148-
let prefix = if table_root.scheme() == "file" {
149-
Path::from_filesystem_path(
150-
table_root
151-
.to_file_path()
152-
.map_err(|_| DeltaTableError::generic("failed to convert fs"))?,
153-
)?
154-
} else {
155-
Path::parse(table_root.path())?
148+
let prefix = match ObjectStoreScheme::parse(table_root) {
149+
Ok((ObjectStoreScheme::AmazonS3, _)) => Path::parse(table_root.path())?,
150+
Ok((_, path)) => path,
151+
_ => Path::parse(table_root.path())?,
156152
};
157153
Ok(if prefix != Path::from("/") {
158154
Box::new(PrefixStore::new(store, prefix)) as Box<dyn ObjectStore>

crates/gcp/tests/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ pub mod gs_cli {
129129
.wait()
130130
}
131131

132+
#[allow(unused)]
132133
pub fn delete_bucket(container_name: impl AsRef<str>) -> std::io::Result<ExitStatus> {
133134
let endpoint = std::env::var("GOOGLE_ENDPOINT_URL")
134135
.expect("variable GOOGLE_ENDPOINT_URL must be set to connect to GCS Emulator");

0 commit comments

Comments
 (0)