gratus00 commented on code in PR #27644:
URL: https://github.com/apache/datafusion/pull/27644#discussion_r4714842610


##########
docs/source/library-user-guide/upgrading/57.0.0.md:
##########
@@ -168,3 +168,48 @@ schema.
 has the names and types of the columns that it reads from the body. The
 optimizer runs this check after each rule in debug builds, so a custom rule
 that does not remap the scans now fails with an error that names the rule.
+
+### `CatalogProvider` and `SchemaProvider` lookup methods now return `Result`
+
+The following methods could not report errors, so implementations backed by a
+remote catalog had to return an empty list, `None`, or `false` when a request
+failed. That was indistinguishable from "no schemas", "schema not found", or
+"table not found". They now return `Result`:
+
+| Trait             | Method           | 56.0.0                            | 
57.0.0                                    |
+| ----------------- | ---------------- | --------------------------------- | 
----------------------------------------- |
+| `CatalogProvider` | `schema_names()` | `Vec<String>`                     | 
`Result<Vec<String>>`                     |
+| `CatalogProvider` | `schema()`       | `Option<Arc<dyn SchemaProvider>>` | 
`Result<Option<Arc<dyn SchemaProvider>>>` |
+| `SchemaProvider`  | `table_names()`  | `Vec<String>`                     | 
`Result<Vec<String>>`                     |
+| `SchemaProvider`  | `table_exist()`  | `bool`                            | 
`Result<bool>`                            |
+
+Implementations that cannot fail can wrap their existing return value in `Ok`:
+
+```rust
+// 56.0.0
+fn table_exist(&self, name: &str) -> bool {
+    self.tables.contains_key(name)
+}
+
+// 57.0.0
+fn table_exist(&self, name: &str) -> Result<bool> {
+    Ok(self.tables.contains_key(name))
+}
+```
+
+Callers need to handle the error, typically with `?`:
+
+```rust
+// 56.0.0
+if let Some(schema) = catalog.schema("public") {
+    for table in schema.table_names() { /* ... */ }
+}
+
+// 57.0.0
+if let Some(schema) = catalog.schema("public")? {
+    for table in schema.table_names()? { /* ... */ }
+}
+```
+
+The FFI wrappers (`FFI_CatalogProvider` and `FFI_SchemaProvider`) carry these

Review Comment:
   I added this note as well



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