tustvold commented on code in PR #4077:
URL: https://github.com/apache/arrow-rs/pull/4077#discussion_r1165545023


##########
object_store/src/lib.rs:
##########
@@ -717,6 +726,139 @@ impl From<Error> for std::io::Error {
     }
 }
 
+/// Creates object store from provided url and options
+///
+/// The scheme of the provided url is used to instantiate the store. If the url
+/// scheme is cannot be mapped to a store, [`NotImplemented`] is raised. For 
invalid
+/// input, e.g. url with no scheme the default behaviour is to return
+/// [`local::LocalFileSystem`].
+///
+/// # Examples
+///
+/// ```
+///
+/// ```
+pub fn parse_url<
+    I: IntoIterator<Item = (impl AsRef<str>, impl Into<String> + Clone)> + 
Clone,
+>(
+    url: impl AsRef<str>,
+    options: I,
+) -> Result<Box<DynObjectStore>> {
+    let storage_url = url.as_ref();
+
+    if let Ok(url) = Url::parse(storage_url) {
+        let opts = options
+            .clone()
+            .into_iter()
+            .map(|(key, value)| (key.as_ref().to_ascii_lowercase(), value));
+
+        let allow_http: bool = options.into_iter().any(|(key, value)| {
+            key.as_ref().to_ascii_lowercase().contains("allow_http")
+                & value.into().eq_ignore_ascii_case("true")
+        });
+
+        match url.scheme() {
+            #[cfg(any(feature = "aws", feature = "aws_profile"))]
+            "s3" | "s3a" => {
+                let opts = opts

Review Comment:
   I guess my concern is that a typo-ed option can result in a very poor 
debugging UX if it doesn't return an error, I'm curious why we would want to 
accept options that aren't valid



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to