dengzhhu653 commented on code in PR #5582:
URL: https://github.com/apache/hive/pull/5582#discussion_r1924641145


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java:
##########
@@ -3362,95 +3362,52 @@ private void updateStatsForTruncate(Map<String,String> 
props, EnvironmentContext
     return;
   }
 
-  private void alterPartitionForTruncate(RawStore ms, String catName, String 
dbName, String tableName,
-                                         Table table, Partition partition, 
String validWriteIds, long writeId) throws Exception {
+  private void alterPartitionsForTruncate(RawStore ms, String catName, String 
dbName, String tableName,
+      Table table, List<Partition> partitions, String validWriteIds, long 
writeId) throws Exception {
     EnvironmentContext environmentContext = new EnvironmentContext();
-    updateStatsForTruncate(partition.getParameters(), environmentContext);
-
-    if (!transactionalListeners.isEmpty()) {
-      MetaStoreListenerNotifier.notifyEvent(transactionalListeners,
-          EventType.ALTER_PARTITION,
-          new AlterPartitionEvent(partition, partition, table, true, true,
-              writeId, this));
-    }
-
-    if (!listeners.isEmpty()) {
-      MetaStoreListenerNotifier.notifyEvent(listeners,
-          EventType.ALTER_PARTITION,
-          new AlterPartitionEvent(partition, partition, table, true, true,
-              writeId, this));
+    if (partitions.isEmpty()) {
+      return;
     }
-
-    if (writeId > 0) {
-      partition.setWriteId(writeId);
+    for (Partition partition: partitions) {
+      updateStatsForTruncate(partition.getParameters(), environmentContext);
+      if (writeId > 0) {
+        partition.setWriteId(writeId);
+      }
     }
-    alterHandler.alterPartition(ms, wh, catName, dbName, tableName, null, 
partition,
-        environmentContext, this, validWriteIds);
+    alterHandler.alterPartitions(ms, wh, catName, dbName, tableName, 
partitions, environmentContext,

Review Comment:
   this operation is in a context of truncation, and we have done almost every 
thing in `HMSHandler`, like reset the column stats, truncate the table 
directory, so in my view, we don't need to call `alterHandler.alterPartitions` 
to perform other actions, such as fetch the partitions from db again, update 
the stats, etc



-- 
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-unsubscr...@hive.apache.org

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


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

Reply via email to