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/06/10 07:59:06 UTC

[GitHub] [hive] maheshk114 commented on a change in pull request #2376: HIVE-25225 : Update column stat throws NPE if direct sql is disabled

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



##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -7006,16 +7006,40 @@ private boolean updatePartitonColStatsInternal(Table tbl, ColumnStatistics colSt
         + " part=" + csd.getPartName());
 
     boolean ret = false;
+
+    Map<String, String> parameters;
+    List<String> partVals;
+    boolean committed = false;
+    getMS().openTransaction();
+
     try {
       if (tbl == null) {
         tbl = getTable(catName, dbName, tableName);
       }
-      ret = updatePartitionColStatsInBatch(tbl, Collections.singletonMap(csd.getPartName(), colStats),
-              validWriteIds, writeId);
+      partVals = getPartValsFromName(tbl, csd.getPartName());
+      parameters = getMS().updatePartitionColumnStatistics(colStats, partVals, validWriteIds, writeId);
+      if (parameters != null) {
+        if (transactionalListeners != null && !transactionalListeners.isEmpty()) {
+          MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
+                  EventType.UPDATE_PARTITION_COLUMN_STAT,
+                  new UpdatePartitionColumnStatEvent(colStats, partVals, parameters, tbl,
+                          writeId, this));
+        }
+        if (!listeners.isEmpty()) {

Review comment:
       This is the old code so i have kept it as it is. Other methods are also using it same way.

##########
File path: standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java
##########
@@ -9037,8 +9061,16 @@ public boolean set_aggr_stats_for(SetPartitionsStatsRequest request) throws TExc
       } else { // No merge.
         Table t = getTable(catName, dbName, tableName);
         // We don't short-circuit on errors here anymore. That can leave acid stats invalid.
-        ret = updatePartitionColStatsInBatch(t, newStatsMap,
-                request.getValidWriteIdList(), request.getWriteId());
+        if (MetastoreConf.getBoolVar(getConf(), ConfVars.TRY_DIRECT_SQL)) {

Review comment:
       I think for get operations it's fine. But for set operations we have to start a transaction in HMS handler and for direct sql flow that may cause issue.




-- 
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.

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