You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/21 18:33:46 UTC

[GitHub] [spark] allisonwang-db commented on a diff in pull request #36291: [SPARK-38974][SQL] Filter registered functions with a given database name in list functions

allisonwang-db commented on code in PR #36291:
URL: https://github.com/apache/spark/pull/36291#discussion_r855487936


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala:
##########
@@ -1753,6 +1753,23 @@ class SessionCatalog(
     }
   }
 
+  /**
+   * List all registered functions in a database with the given pattern.
+   */
+  private def listRegisteredFunctions(db: String, pattern: String): Seq[FunctionIdentifier] = {
+    val functions = (functionRegistry.listFunction() ++ tableFunctionRegistry.listFunction())
+      .filter(_.database.forall(_ == db))
+    StringUtils.filterPattern(functions.map(_.unquotedString), pattern).map { f =>

Review Comment:
   https://github.com/apache/spark/pull/35056#issue-1090368357 if we still want to support the legacy `SHOW FUNCTIONS LIKE 'db.func'`, then we probably can't filter out the registered functions from another database. 
   
   But `SHOW FUNCTIONS LIKE 'db.func'` can only show **registered** functions from another database, and is different from `SHOW FUNCTIONS IN db LIKE 'func'`.



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org