You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2021/09/21 07:42:03 UTC

[GitHub] [hive] maheshk114 commented on a change in pull request #2636: HIVE-24776:Reduce HMS DB calls during stats updates

maheshk114 commented on a change in pull request #2636:
URL: https://github.com/apache/hive/pull/2636#discussion_r712748333



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -9700,8 +9705,7 @@ private void writeMPartitionColumnStatistics(Table table, Partition partition,
       Map<String, MPartitionColumnStatistics> oldStats = getPartitionColStats(table, statsDesc
           .getPartName(), colNames, colStats.getEngine());
 
-      MPartition mPartition = getMPartition(
-          catName, statsDesc.getDbName(), statsDesc.getTableName(), partVals, mTable);
+      //MPartition mPartition = convertToMPart(partition,mTable,false);
       if (partition == null) {

Review comment:
       this check can be moved up.

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
##########
@@ -9687,10 +9688,14 @@ private void writeMPartitionColumnStatistics(Table table, Partition partition,
       List<ColumnStatisticsObj> statsObjs = colStats.getStatsObj();
       ColumnStatisticsDesc statsDesc = colStats.getStatsDesc();
       String catName = statsDesc.isSetCatName() ? statsDesc.getCatName() : getDefaultCatalog(conf);
-      MTable mTable = ensureGetMTable(catName, statsDesc.getDbName(), statsDesc.getTableName());
-      Table table = convertToTable(mTable);
-      Partition partition = convertToPart(getMPartition(
-          catName, statsDesc.getDbName(), statsDesc.getTableName(), partVals, mTable), false);
+      if(table == null) {
+        MTable mTable = ensureGetMTable(catName, statsDesc.getDbName(), statsDesc.getTableName());
+        table = convertToTable(mTable);
+      }
+      //MTable mTable = ensureGetMTable(catName, statsDesc.getDbName(), statsDesc.getTableName());
+      MTable mTable = convertToMTable(table);

Review comment:
       convertToMTable is redundant incase table is null

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -75,6 +75,8 @@
 
 import com.google.common.annotations.VisibleForTesting;
 
+import javax.servlet.http.Part;

Review comment:
       why this import is required ?

##########
File path: standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java
##########
@@ -691,9 +691,9 @@ private void createPartitionedTable(boolean withPrivileges, boolean withStatisti
 
         ColumnStatisticsObj partStats = new ColumnStatisticsObj("test_part_col", "int", data);
         statsObjList.add(partStats);
-
+        //Table tbl = objectStore.getTable(tbl1.getCatName(),tbl1.getDbName(),tbl1.getTableName());

Review comment:
       remove this line

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
##########
@@ -2197,18 +2199,26 @@ private void updatePartitionColumnStatisticsInCache(ColumnStatistics colStats, M
     sharedCache.updatePartitionColStatsInCache(catName, dbName, tblName, partVals, colStats.getStatsObj());
   }
 
-  @Override public Map<String, String> updatePartitionColumnStatistics(ColumnStatistics colStats, List<String> partVals,
+  @Override
+  public Map<String, String> updatePartitionColumnStatistics(Table table,
+      ColumnStatistics colStats, List<String> partVals,
       String validWriteIds, long writeId)
       throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
     Map<String, String> newParams =
-        rawStore.updatePartitionColumnStatistics(colStats, partVals, validWriteIds, writeId);
+        rawStore.updatePartitionColumnStatistics(table, colStats, partVals, validWriteIds, writeId);
     // in case of event based cache update, cache is updated during commit txn
     if (newParams != null && !canUseEvents) {
       updatePartitionColumnStatisticsInCache(colStats, newParams, partVals);
     }
     return newParams;
   }
 
+  @Override public Map<String, String> updatePartitionColumnStatistics(ColumnStatistics statsObj, List<String> partVals,
+      String validWriteIds, long writeId)
+      throws NoSuchObjectException, MetaException, InvalidObjectException, InvalidInputException {
+    return updatePartitionColumnStatistics(null, statsObj, partVals, validWriteIds, writeId);

Review comment:
       why not call the rawstore API without table ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org