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

sunchao pushed a commit to branch branch-2.3
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/branch-2.3 by this push:
     new c78ff81  HIVE-24608: Switch back to get_table in HMS client for Hive 
2.3.x (#2080)
c78ff81 is described below

commit c78ff81915ff3f54d3b1e7c3ce1f11a6fdf749b2
Author: Chao Sun <sunc...@apache.org>
AuthorDate: Fri May 14 10:03:58 2021 -0700

    HIVE-24608: Switch back to get_table in HMS client for Hive 2.3.x (#2080)
---
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java |  2 +-
 .../apache/hadoop/hive/metastore/HiveMetaStoreClient.java | 15 +++------------
 2 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java 
b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 412e7d0..46a7430 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -601,7 +601,7 @@ public class HiveConf extends Configuration {
     METASTOREURIS("hive.metastore.uris", "",
         "Thrift URI for the remote metastore. Used by metastore client to 
connect to remote metastore."),
 
-    METASTORE_CAPABILITY_CHECK("hive.metastore.client.capability.check", true,
+    METASTORE_CAPABILITY_CHECK("hive.metastore.client.capability.check", false,
         "Whether to check client capabilities for potentially breaking API 
usage."),
     METASTORE_FASTPATH("hive.metastore.fastpath", false,
         "Used to avoid all of the proxies and object copies in the metastore.  
Note, if this is " +
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 971a8a4..53d97ff 100644
--- 
a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ 
b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -121,7 +121,6 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
   // for thrift connects
   private int retries = 5;
   private long retryDelaySeconds = 0;
-  private final ClientCapabilities version;
 
   static final protected Logger LOG = 
LoggerFactory.getLogger("hive.metastore");
 
@@ -143,7 +142,6 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
     } else {
       this.conf = new HiveConf(conf);
     }
-    version = HiveConf.getBoolVar(conf, ConfVars.HIVE_IN_TEST) ? TEST_VERSION 
: VERSION;
     filterHook = loadFilterHooks();
     fileMetadataBatchSize = HiveConf.getIntVar(
         conf, HiveConf.ConfVars.METASTORE_BATCH_RETRIEVE_OBJECTS_MAX);
@@ -1345,9 +1343,7 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
   @Override
   public Table getTable(String dbname, String name) throws MetaException,
       TException, NoSuchObjectException {
-    GetTableRequest req = new GetTableRequest(dbname, name);
-    req.setCapabilities(version);
-    Table t = client.get_table_req(req).getTable();
+    Table t = client.get_table(dbname, name);
     return fastpath ? t : deepCopy(filterHook.filterTable(t));
   }
 
@@ -1364,10 +1360,7 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
   @Override
   public List<Table> getTableObjectsByName(String dbName, List<String> 
tableNames)
       throws MetaException, InvalidOperationException, UnknownDBException, 
TException {
-    GetTablesRequest req = new GetTablesRequest(dbName);
-    req.setTblNames(tableNames);
-    req.setCapabilities(version);
-    List<Table> tabs = client.get_table_objects_by_name_req(req).getTables();
+    List<Table> tabs = client.get_table_objects_by_name(dbName, tableNames);
     return fastpath ? tabs : deepCopyTables(filterHook.filterTables(tabs));
   }
 
@@ -1459,9 +1452,7 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
   public boolean tableExists(String databaseName, String tableName) throws 
MetaException,
       TException, UnknownDBException {
     try {
-      GetTableRequest req = new GetTableRequest(databaseName, tableName);
-      req.setCapabilities(version);
-      return filterHook.filterTable(client.get_table_req(req).getTable()) != 
null;
+      return filterHook.filterTable(client.get_table(databaseName, tableName)) 
!= null;
     } catch (NoSuchObjectException e) {
       return false;
     }

Reply via email to