caicancai commented on code in PR #17307:
URL: https://github.com/apache/datafusion/pull/17307#discussion_r2301114549


##########
datafusion/core/tests/catalog/memory.rs:
##########
@@ -47,6 +47,20 @@ fn memory_catalog_dereg_nonempty_schema() {
     assert!(cat.deregister_schema("foo", true).unwrap().is_some());
 }
 
+#[test]
+fn memory_catalog_dereg_nonempty_schema_with_table_removal() {
+    let cat = Arc::new(MemoryCatalogProvider::new()) as Arc<dyn 
CatalogProvider>;
+
+    let schema = Arc::new(MemorySchemaProvider::new()) as Arc<dyn 
SchemaProvider>;
+    let test_table =
+        Arc::new(EmptyTable::new(Arc::new(Schema::empty()))) as Arc<dyn 
TableProvider>;
+    schema.register_table("t".into(), test_table).unwrap();
+
+    cat.register_schema("foo", schema.clone()).unwrap();
+    schema.deregister_table("t").unwrap();
+    assert!(cat.deregister_schema("foo", false).unwrap().is_some());

Review Comment:
   Thanks for the suggestion, but the above code will report an error
   
   >  `called `Result::unwrap_err()` on an `Ok` value: 
Some(MemorySchemaProvider { tables: {} })`



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to