rdtr commented on code in PR #56179:
URL: https://github.com/apache/spark/pull/56179#discussion_r3316240782


##########
sql/core/src/test/scala/org/apache/spark/sql/connector/DataSourceV2FunctionSuite.scala:
##########
@@ -726,6 +726,17 @@ class DataSourceV2FunctionSuite extends 
DatasourceV2SQLBase {
     checkAnswer(sql("SELECT testcat.ns.simple_strlen('abc')"), Row(3) :: Nil)
     checkAnswer(sql("SELECT testcat.ns.simple_strlen('hello world')"), Row(11) 
:: Nil)
   }
+
+  test("SPARK-55982: function should not resolve after namespace is dropped") {
+    val cat = catalog("testcat").asInstanceOf[InMemoryCatalog]
+    cat.createNamespace(Array("dropns"), new java.util.HashMap[String, 
String]())
+    addFunction(Identifier.of(Array("dropns"), "strlen"), SimpleStrLen)
+    checkAnswer(sql("SELECT testcat.dropns.strlen('abc')"), Row(3) :: Nil)
+    sql("DROP NAMESPACE testcat.dropns CASCADE")

Review Comment:
   Could we wrap this in the existing `withNamespace("testcat.dropns") { ... } 
` helper from `QueryTest`? It does a DROP NAMESPACE IF EXISTS ... CASCADE in a 
finally, so an unexpected failure mid-test won't leak the namespace/function 
into the next one. 



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