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


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -297,4 +302,29 @@ class JDBCTableCatalog extends TableCatalog with 
SupportsNamespaces with Logging
   private def getTableName(ident: Identifier): String = {
     (ident.namespace() :+ 
ident.name()).map(dialect.quoteIdentifier).mkString(".")
   }
+
+  override def listFunctions(namespace: Array[String]): Array[Identifier] = {
+    if (namespace.isEmpty) {
+      functions.keys.map(Identifier.of(namespace, _)).toArray
+    } else {
+      throw QueryCompilationErrors.noSuchNamespaceError(namespace)
+    }
+  }
+
+  override def loadFunction(ident: Identifier): UnboundFunction = {
+    if (ident.namespace().nonEmpty) {
+      throw QueryCompilationErrors.namespaceInJdbcUDFUnsupportedError(ident)
+    }
+    functions.get(ident.name()) match {
+      case Some(func) =>
+        func
+      case _ =>
+        throw new NoSuchFunctionException(ident)
+    }
+  }
+
+  // test only
+  def clearFunctions(): Unit = {

Review Comment:
   it's weird that we put `registerFunction` in H2Dialect but put 
`clearFunctions` here.



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