dengzhhu653 commented on code in PR #5582:
URL: https://github.com/apache/hive/pull/5582#discussion_r1916328265
##########
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:
since we know this is a truncation op, can we just call
`ms.alterPartitions(catName, dbname, name, partValsList, new_parts, writeId,
writeIdList)` and create the event directly? same for truncating the
non-partitioned 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]