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

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


The following commit(s) were added to refs/heads/master by this push:
     new b6ccf163c IMPALA-12483: Add new api in MetastoreServiceHandler for 
update_transaction_statistics method
b6ccf163c is described below

commit b6ccf163ccd8aa8f559151ddff7250112dc7d374
Author: Sai Hemanth Gantasala <[email protected]>
AuthorDate: Wed Oct 11 18:00:28 2023 -0700

    IMPALA-12483: Add new api in MetastoreServiceHandler
    for update_transaction_statistics method
    
    In the MetastoreServiceHandler class, the
    'update_transaction_statistics' API implementation is missing which is
    causing test failures in the external front end integration tests.
    This needs to be fixed by adding implementation of the
    'update_transaction_statistics' api in MetastoreServiceHandler class.
    
    This API was introduced in HMS long ago but only recently we
    encountered a bug with this missing API when testing materialized views
    with transactional properties in the external front-end setup.
    
    Testing:
    Added a test in the 'test_hms_apis()' to verify that the
    'update_transaction_statistics' api in HMS is reachable from impala.
    
    Change-Id: Icd9bc47ff8c6e5e7b31961d7ee6b8c1d4bd74870
    Reviewed-on: http://gerrit.cloudera.org:8080/20567
    Tested-by: Impala Public Jenkins <[email protected]>
    Reviewed-by: Quanlong Huang <[email protected]>
---
 .../impala/catalog/metastore/MetastoreServiceHandler.java   |  9 +++++++++
 tests/custom_cluster/test_metastore_service.py              | 13 +++++++++++++
 2 files changed, 22 insertions(+)

diff --git 
a/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
 
b/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
index fbcd66266..859d71c49 100644
--- 
a/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
+++ 
b/fe/src/main/java/org/apache/impala/catalog/metastore/MetastoreServiceHandler.java
@@ -238,6 +238,7 @@ import 
org.apache.hadoop.hive.metastore.api.UniqueConstraintsResponse;
 import org.apache.hadoop.hive.metastore.api.UnknownDBException;
 import org.apache.hadoop.hive.metastore.api.UnknownTableException;
 import org.apache.hadoop.hive.metastore.api.UnlockRequest;
+import org.apache.hadoop.hive.metastore.api.UpdateTransactionalStatsRequest;
 import org.apache.hadoop.hive.metastore.api.WMAlterPoolRequest;
 import org.apache.hadoop.hive.metastore.api.WMAlterPoolResponse;
 import org.apache.hadoop.hive.metastore.api.WMAlterResourcePlanRequest;
@@ -2544,6 +2545,14 @@ public abstract class MetastoreServiceHandler extends 
AbstractThriftHiveMetastor
     }
   }
 
+  @Override
+  public void update_transaction_statistics(UpdateTransactionalStatsRequest 
req)
+      throws MetaException, TException {
+    try (MetaStoreClient client = catalog_.getMetaStoreClient()) {
+      
client.getHiveClient().getThriftClient().update_transaction_statistics(req);
+    }
+  }
+
   @Override
   public CmRecycleResponse cm_recycle(CmRecycleRequest cmRecycleRequest)
       throws MetaException, TException {
diff --git a/tests/custom_cluster/test_metastore_service.py 
b/tests/custom_cluster/test_metastore_service.py
index fca6f3c4c..899ea633f 100644
--- a/tests/custom_cluster/test_metastore_service.py
+++ b/tests/custom_cluster/test_metastore_service.py
@@ -27,6 +27,7 @@ from hive_metastore.ttypes import TruncateTableRequest
 from hive_metastore.ttypes import Table
 from hive_metastore.ttypes import StorageDescriptor
 from hive_metastore.ttypes import SerDeInfo
+from hive_metastore.ttypes import UpdateTransactionalStatsRequest
 from hive_metastore.ttypes import WriteNotificationLogBatchRequest
 
 from tests.util.event_processor_utils import EventProcessorUtils
@@ -990,6 +991,7 @@ class TestMetastoreService(CustomClusterTestSuite):
         MetastoreServiceHandler in impala can talk to HMS through these APIs):
         1.  find_next_compact2
         2.  add_write_notification_log_in_batch
+        3.  update_transaction_statistics
         """
         catalog_hms_client = None
         tbl_name = ImpalaTestSuite.get_random_name(
@@ -1016,6 +1018,17 @@ class TestMetastoreService(CustomClusterTestSuite):
             
catalog_hms_client.add_write_notification_log_in_batch(logBatchRequest)
             # If the above call is successful then HMS api
             # add_write_notification_log_in_batch is reachable.
+
+            # Test 3: verify update_transaction_statistics api in HMS
+            stats_obj = UpdateTransactionalStatsRequest()
+            stats_obj.tableId = 1
+            stats_obj.insertCount = 1
+            stats_obj.updatedCount = 1
+            stats_obj.deletedCount = 1
+            catalog_hms_client.update_transaction_statistics(stats_obj)
+            # If the above call is successful the HMS api
+            # update_transaction_statistics is reachable
+
             catalog_hms_client.drop_table("default", tbl_name, True)
         finally:
             if catalog_hms_client is not None:

Reply via email to