You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ng...@apache.org on 2021/04/06 15:40:10 UTC

[hive] 26/38: HIVE-24396: get_table_core() to return null instead of exception

This is an automated email from the ASF dual-hosted git repository.

ngangam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git

commit 5c98e3073e52431bcece39cdfe7e655abf1917b0
Author: Naveen Gangam <ng...@cloudera.com>
AuthorDate: Tue Dec 1 15:50:12 2020 -0500

    HIVE-24396: get_table_core() to return null instead of exception
---
 .../org/apache/hadoop/hive/metastore/HiveMetaStore.java   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 26552d1..638b426 100644
--- a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -3739,12 +3739,19 @@ public class HiveMetaStore extends ThriftHiveMetastore {
       Table t = null;
       try {
         db = get_database_core(catName, dbname);
-        if (db != null) {
-          if (db.getType().equals(DatabaseType.REMOTE)) {
-            return DataConnectorProviderFactory.getDataConnectorProvider(db).getTable(name);
+      } catch (Exception e) { /* appears exception is not thrown currently if db doesnt exist */ }
+
+      if (db != null) {
+        if (db.getType().equals(DatabaseType.REMOTE)) {
+          t = DataConnectorProviderFactory.getDataConnectorProvider(db).getTable(name);
+          if (t == null) {
+            throw new NoSuchObjectException(TableName.getQualified(catName, dbname, name) +
+              " table not found");
           }
+          t.setDbName(dbname);
+          return t;
         }
-      } catch (Exception e) { /* appears exception is not thrown currently if db doesnt exist */ }
+      }
 
       try {
         t = getMS().getTable(catName, dbname, name, writeIdList);