From commits-return-36572-archive-asf-public=cust-asf.ponee.io@spark.apache.org Thu Apr 11 01:00:35 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 773C0180763 for ; Thu, 11 Apr 2019 03:00:35 +0200 (CEST) Received: (qmail 82423 invoked by uid 500); 11 Apr 2019 01:00:34 -0000 Mailing-List: contact commits-help@spark.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@spark.apache.org Received: (qmail 82396 invoked by uid 99); 11 Apr 2019 01:00:34 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Apr 2019 01:00:34 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A3A2B80D93; Thu, 11 Apr 2019 01:00:34 +0000 (UTC) Date: Thu, 11 Apr 2019 01:00:33 +0000 To: "commits@spark.apache.org" Subject: [spark] branch master updated: [MINOR][SQL] Unnecessary access to externalCatalog MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155494443254.13546.1169039787816836992@gitbox.apache.org> From: gurwls223@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: spark X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ab8710b57916a129fcb89464209361120d224535 X-Git-Newrev: 181d190c606ec6cbd09f6d618347b60eaa4ea828 X-Git-Rev: 181d190c606ec6cbd09f6d618347b60eaa4ea828 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. gurwls223 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/spark.git The following commit(s) were added to refs/heads/master by this push: new 181d190 [MINOR][SQL] Unnecessary access to externalCatalog 181d190 is described below commit 181d190c606ec6cbd09f6d618347b60eaa4ea828 Author: ocaballero AuthorDate: Thu Apr 11 10:00:09 2019 +0900 [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 Signed-off-by: HyukjinKwon --- .../org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala index 4b862a5..c05f777 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala @@ -1105,10 +1105,11 @@ class SessionCatalog( * Check if the function with the specified name exists */ def functionExists(name: FunctionIdentifier): Boolean = { - val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase)) - requireDbExists(db) - functionRegistry.functionExists(name) || + functionRegistry.functionExists(name) || { + val db = formatDatabaseName(name.database.getOrElse(getCurrentDatabase)) + requireDbExists(db) externalCatalog.functionExists(db, name.funcName) + } } // ---------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org For additional commands, e-mail: commits-help@spark.apache.org