[MINOR][SQL] Unnecessary access to externalCatalog

Necessarily access the external catalog without having to do it

## What changes were proposed in this pull request?

The existsFunction function has been changed because it unnecessarily accessed the externalCatalog to find if the database exists in cases where the function is in the functionRegistry

## How was this patch tested?

It has been tested through spark-shell and accessing the metastore logs of hive.

Inside spark-shell we use spark.table (% tableA%). SelectExpr ("trim (% columnA%)") in the current version and it appears every time:

org.apache.hadoop.hive.metastore.HiveMetaStore.audit: cmd = get_database: default

Once the change is made, no record appears

Closes #24312 from OCaballero/master.

Authored-by: ocaballero <oliver.caballero.alvarez@gmail.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
This commit is contained in:
ocaballero 2019-04-11 10:00:09 +09:00 committed by HyukjinKwon
parent ab8710b579
commit 181d190c60

View file

@ -1105,11 +1105,12 @@ class SessionCatalog(
* Check if the function with the specified name exists
*/
def functionExists(name: FunctionIdentifier): Boolean = {
functionRegistry.functionExists(name) || {
val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase))
requireDbExists(db)
functionRegistry.functionExists(name) ||
externalCatalog.functionExists(db, name.funcName)
}
}
// ----------------------------------------------------------------
// | Methods that interact with temporary and metastore functions |