kosiew commented on code in PR #21944:
URL: https://github.com/apache/datafusion/pull/21944#discussion_r3464613695


##########
datafusion-examples/examples/data_io/catalog.rs:
##########
@@ -237,20 +237,20 @@ impl CatalogProvider for DirCatalog {
         Ok(Some(schema))
     }
 
-    fn schema_names(&self) -> Vec<String> {
+    fn schema_names(&self) -> Result<Vec<String>> {
         let schemas = self.schemas.read().unwrap();
-        schemas.keys().cloned().collect()
+        Ok(schemas.keys().cloned().collect())
     }
 
-    fn schema(&self, name: &str) -> Option<Arc<dyn SchemaProvider>> {
+    fn schema(&self, name: &str) -> Result<Option<Arc<dyn SchemaProvider>>> {
         let schemas = self.schemas.read().unwrap();
         let maybe_schema = schemas.get(name);

Review Comment:
   Small cleanup suggestion: this manual `if let Some` can be collapsed to the 
direct lookup result, since the map already stores `Arc<dyn SchemaProvider>`:
   
   ```rust
   Ok(schemas.get(name).cloned())
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to