Github user WeichenXu123 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20795#discussion_r176039913
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
---
@@ -1076,6 +1076,16 @@ class SessionCatalog(
externalCatalog.functionExists(db, name.funcName)
}
+ def buildinFunctionExists(name: FunctionIdentifier): Boolean = {
+ functionRegistry.functionExists(name)
+ }
+
+ def externalFunctionExists(name: FunctionIdentifier): Boolean = {
+ val db =
formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
+ requireDbExists(db)
+ externalCatalog.functionExists(db, name.funcName)
+ }
+
--- End diff --
To avoid code duplication, you should modify the `functionExists` like:
```
def functionExists(name: FunctionIdentifier): Boolean = {
buildinFunctionExists(name) || externalFunctionExists(name)
}
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]