You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by gatorsmile <gi...@git.apache.org> on 2018/04/01 23:37:34 UTC
[GitHub] spark pull request #20795: [SPARK-23486]cache the function name from the cat...
Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/20795#discussion_r178471806
--- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala ---
@@ -1072,8 +1072,17 @@ class SessionCatalog(
def functionExists(name: FunctionIdentifier): Boolean = {
val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
requireDbExists(db)
- functionRegistry.functionExists(name) ||
- externalCatalog.functionExists(db, name.funcName)
+ builtinFunctionExists(name) || externalFunctionExists(name)
+ }
+
+ def builtinFunctionExists(name: FunctionIdentifier): Boolean = {
--- End diff --
```Scala
/**
* Returns whether this function has been registered in the function registry of the current
* session. If not existed, returns false.
*/
def isRegisteredFunction(name: FunctionIdentifier): Boolean = {
functionRegistry.functionExists(name)
}
/**
* Returns whether it is a persistent function. If not existed, returns false.
*/
def isPersistentFunction(name: FunctionIdentifier): Boolean = {
val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
databaseExists(db) && externalCatalog.functionExists(db, name.funcName)
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org