zeroshade commented on code in PR #3099:
URL: https://github.com/apache/arrow-adbc/pull/3099#discussion_r2190789902


##########
rust/core/src/driver_manager.rs:
##########
@@ -316,6 +408,65 @@ impl Driver for ManagedDriver {
     }
 }
 
+fn get_optional_key(manifest: &Table, key: &str) -> String {
+    manifest
+        .get(key)
+        .and_then(Value::as_str)
+        .unwrap_or_default()
+        .to_string()
+}
+
+fn load_driver_manifest(info: &mut DriverInfo) -> Result<()> {
+    let contents = 
fs::read_to_string(info.manifest_file.as_path()).map_err(|e| {
+        let file = info.manifest_file.to_string_lossy();
+        Error::with_message_and_status(
+            format!("Could not read manifest '{file}': {e}"),
+            Status::InvalidArguments,
+        )
+    })?;
+
+    let manifest = contents
+        .parse::<Table>()
+        .map_err(|e| Error::with_message_and_status(e.to_string(), 
Status::InvalidArguments))?;

Review Comment:
   I've updated this to use the serde implementation that @mbrobbel suggested. 
While it does make the implementation of `load_driver_manifest` in 
`driver_manager.rs` much simpler, it is at the expense of the complexity of the 
`manifest.rs` file itself and custom serde etc.
   
   I'll let all of you decide what makes the most sense here as I'm not as 
familiar with the benefits or drawbacks here. @phillipleblanc @lidavidm either 
of you have an opinion here also?



-- 
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