dengzhhu653 commented on code in PR #6935:
URL: https://github.com/apache/hive/pull/6935#discussion_r4520356858
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/handler/TruncateTableHandler.java:
##########
@@ -142,112 +122,171 @@ protected TruncateTableResult execute() throws
TException, IOException {
.map(Boolean::parseBoolean)
.orElse(false);
- if (TxnUtils.isTransactionalTable(table) || !skipDataDeletion) {
- if (!skipDataDeletion) {
- isSkipTrash = MetaStoreUtils.isSkipTrash(table.getParameters());
- Database db = handler.get_database_core(catName, dbName);
- needCmRecycle = ReplChangeManager.shouldEnableCm(db, table);
- }
- List<Path> locations = new ArrayList<>();
- if (0 != table.getPartitionKeysSize()) {
- for (Partition partition : partitions) {
- locations.add(new Path(partition.getSd().getLocation()));
+ boolean success;
+ if (isPartitioned) {
+ success = truncatePartitionedTable(isSkipTrash, needCmRecycle,
skipDataDeletion);
+ } else {
+ if (TxnUtils.isTransactionalTable(table) || !skipDataDeletion) {
+ if (!skipDataDeletion) {
+ isSkipTrash = MetaStoreUtils.isSkipTrash(table.getParameters());
+ Database db = handler.get_database_core(catName, dbName);
+ needCmRecycle = ReplChangeManager.shouldEnableCm(db, table);
}
- } else {
- locations.add(new Path(table.getSd().getLocation()));
- }
- // This is not transactional
- for (Path location : locations) {
+ Path location = new Path(table.getSd().getLocation());
if (!skipDataDeletion) {
truncateDataFiles(location, isSkipTrash, needCmRecycle);
} else {
- // For Acid tables we don't need to delete the old files, only write
an empty baseDir.
- // Compaction and cleaner will take care of the rest
Review Comment:
ack
--
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]