cloud-fan commented on code in PR #56179:
URL: https://github.com/apache/spark/pull/56179#discussion_r3449098777


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryCatalog.scala:
##########
@@ -27,6 +27,19 @@ import 
org.apache.spark.sql.connector.catalog.functions.UnboundFunction
 import org.apache.spark.sql.connector.catalog.procedures.UnboundProcedure
 
 class InMemoryCatalog extends InMemoryTableCatalog with FunctionCatalog with 
ProcedureCatalog {
+  override def dropNamespace(namespace: Array[String], cascade: Boolean): 
Boolean = {
+    if (cascade) {
+      // SPARK-55982: Remove functions and procedures in this namespace before 
dropping.
+      // Only needed for cascade=true because without cascade, 
super.dropNamespace
+      // will fail if the namespace still contains tables or child namespaces.
+      listFunctions(namespace).foreach(ident => functions.remove(ident))
+      procedures.keySet.asScala

Review Comment:
   The new procedures cleanup isn't covered by a regression test, while the 
functions path is (the new `DataSourceV2FunctionSuite` test). Consider a 
parallel test — register a procedure in a namespace, `DROP NAMESPACE ... 
CASCADE`, then assert it no longer resolves — ideally in the dedicated 
`ProcedureSuite`. Non-blocking, since this path directly mirrors the tested 
functions path.



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