diff --git a/Cargo.lock b/Cargo.lock index 3745df7..6406de8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1026,7 +1026,7 @@ dependencies = [ [[package]] name = "object_store" version = "0.5.2" -source = "git+https://github.com/roeap/arrow-rs?rev=3ab6ac8ab66ca5387c8265eacb00279253004bb9#3ab6ac8ab66ca5387c8265eacb00279253004bb9" +source = "git+https://github.com/roeap/arrow-rs?rev=7dea6c8ee68dbda781ee613e537f2a65891ed322#7dea6c8ee68dbda781ee613e537f2a65891ed322" dependencies = [ "async-trait", "aws-config", @@ -1036,7 +1036,6 @@ dependencies = [ "chrono", "futures", "itertools", - "once_cell", "parking_lot", "percent-encoding", "quick-xml", diff --git a/Cargo.toml b/Cargo.toml index 43913a5..beb2576 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,4 +2,4 @@ members = ["object-store"] [patch.crates-io] -object_store = { git = "https://github.com/roeap/arrow-rs", rev = "3ab6ac8ab66ca5387c8265eacb00279253004bb9" } +object_store = { git = "https://github.com/roeap/arrow-rs", rev = "7dea6c8ee68dbda781ee613e537f2a65891ed322" } diff --git a/object-store/src/builder.rs b/object-store/src/builder.rs index a9c6b3d..2da2e93 100644 --- a/object-store/src/builder.rs +++ b/object-store/src/builder.rs @@ -99,8 +99,12 @@ impl ObjectStoreBuilder { } } - pub fn with_options(mut self, options: HashMap) -> Self { - self.options = options; + pub fn with_options, impl Into)>>( + mut self, + options: I, + ) -> Self { + self.options + .extend(options.into_iter().map(|(k, v)| (k.into(), v.into()))); self } @@ -158,7 +162,7 @@ impl ObjectStoreBuilder { ObjectStoreKind::Azure => { let maybe_store = MicrosoftAzureBuilder::new() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.clone().unwrap_or_default()) .with_retry(self.retry_config.clone().unwrap_or_default()) .build(); @@ -167,7 +171,7 @@ impl ObjectStoreBuilder { } else { let store = MicrosoftAzureBuilder::from_env() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.unwrap_or_default()) .with_retry(self.retry_config.unwrap_or_default()) .build()?; @@ -177,7 +181,7 @@ impl ObjectStoreBuilder { ObjectStoreKind::S3 => { let maybe_store = AmazonS3Builder::new() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.clone().unwrap_or_default()) .with_retry(self.retry_config.clone().unwrap_or_default()) .build(); @@ -186,7 +190,7 @@ impl ObjectStoreBuilder { } else { let store = AmazonS3Builder::from_env() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.unwrap_or_default()) .with_retry(self.retry_config.unwrap_or_default()) .build()?; @@ -196,7 +200,7 @@ impl ObjectStoreBuilder { ObjectStoreKind::Google => { let maybe_store = GoogleCloudStorageBuilder::new() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.clone().unwrap_or_default()) .with_retry(self.retry_config.clone().unwrap_or_default()) .build(); @@ -205,7 +209,7 @@ impl ObjectStoreBuilder { } else { let store = GoogleCloudStorageBuilder::from_env() .with_url(url.clone()) - .with_options(&self.options) + .try_with_options(&self.options)? .with_client_options(self.client_options.unwrap_or_default()) .with_retry(self.retry_config.unwrap_or_default()) .build()?;