Copilot commented on code in PR #13105:
URL: https://github.com/apache/gluten/pull/13105#discussion_r4098338817


##########
backends-velox/src/test/scala/org/apache/gluten/expression/UDFResolverSuite.scala:
##########
@@ -74,4 +76,32 @@ class UDFResolverSuite extends AnyFunSuite with 
BeforeAndAfterEach {
     UDFResolver.UDFNames ++= Seq("b_udf", "a_udf")
     assert(describedNames() == Seq("a_udf", "b_udf"))
   }
+
+  // Looking up an unregistered name used to fail inside UDFMap.getOrElse. A 
function declared
+  // by name alone has no UDFMap entry, so the lookup no longer throws there 
and the miss has to
+  // be caught after binding instead.
+  test("an unregistered udf is not supported") {
+    intercept[GlutenNotSupportException] {
+      UDFResolver.getUdfExpression("not_registered", 
"not_registered")(Seq(Literal(1)))
+    }
+  }
+
+  test("an unregistered udaf is not supported") {
+    intercept[GlutenNotSupportException] {
+      UDFResolver.getUdafExpression("not_registered")(Seq(Literal(1)))
+    }
+  }
+
+  // A function declared by name alone is offloaded through the same UDFNames 
/ UDAFNames gates
+  // as one with a stated signature; only where its types come from differs.
+  test("a udf declared by name alone is registered") {
+    UDFResolver.registerRegistryUDF("myudf_map_cardinality")
+    assert(UDFResolver.UDFNames.contains("myudf_map_cardinality"))
+    assert(describedNames() == Seq("myudf_map_cardinality"))
+  }
+
+  test("a udaf declared by name alone is registered") {
+    UDFResolver.registerRegistryUDAF("myudaf_arbitrary")

Review Comment:
   This test mutates both the JVM-global UDAFNames and the private 
RegistryUDAFNames set, but beforeEach/afterEach only saves and restores 
UDFNames. The registry name therefore remains registered after this test, so 
later tests can attempt native resolution for myudaf_arbitrary without a 
library and become order-dependent. Extend the fixture cleanup (or otherwise 
isolate this registration) before adding this test.



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