You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "roeap (via GitHub)" <gi...@apache.org> on 2023/05/12 06:02:02 UTC

[GitHub] [arrow-rs] roeap commented on a diff in pull request #4208: feat(object-store): extend client option configuration keys

roeap commented on code in PR #4208:
URL: https://github.com/apache/arrow-rs/pull/4208#discussion_r1191937269


##########
object_store/Cargo.toml:
##########
@@ -33,6 +33,7 @@ async-trait = "0.1.53"
 bytes = "1.0"
 chrono = { version = "0.4.23", default-features = false, features = ["clock"] }
 futures = "0.3"
+humantime = "2.1"

Review Comment:
   Here we introduce a new dependency, but since humantime itself comes dependency-free i felt we can justify this?
   
   The crate has not seen any updated for quite some time, but is relied upon by some of the msot widely used crates, like cargo, clap, and rustsec.



##########
object_store/src/config.rs:
##########
@@ -79,3 +84,51 @@ impl Parse for bool {
         }
     }
 }
+
+impl Parse for Duration {
+    fn parse(v: &str) -> Result<Self> {
+        parse_duration(v).map_err(|_| Error::Generic {
+            store: "Config",
+            source: format!("failed to parse \"{v}\" as Duration").into(),
+        })
+    }
+}
+
+impl Parse for usize {
+    fn parse(v: &str) -> Result<Self> {
+        Self::from_str(v).map_err(|_| Error::Generic {
+            store: "Config",
+            source: format!("failed to parse \"{v}\" as usize").into(),
+        })
+    }
+}
+
+impl Parse for HeaderValue {
+    fn parse(v: &str) -> Result<Self> {
+        Self::from_str(v).map_err(|_| Error::Generic {
+            store: "Config",
+            source: format!("failed to parse \"{v}\" as HeaderValue").into(),
+        })
+    }
+}
+
+pub(crate) fn fmt_duration(duration: &ConfigValue<Duration>) -> String {

Review Comment:
   `Duration` does not implement `Display`, but we also cannot implement `Display` for `ConfigValue<Duration>`, since the compiler believes this may be implemented one day, at which time it would conflict with the generic implementation. Thus i went for a simple function.



-- 
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-unsubscribe@arrow.apache.org

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