deniskuzZ commented on code in PR #5248:
URL: https://github.com/apache/hive/pull/5248#discussion_r1644491641


##########
ql/src/java/org/apache/hadoop/hive/ql/ddl/table/storage/compact/AlterTableCompactOperation.java:
##########
@@ -141,11 +142,13 @@ private List<Partition> getPartitions(Table table, 
AlterTableCompactDesc desc, D
     } else {
       Map<String, String> partitionSpec = desc.getPartitionSpec();
       partitions = context.getDb().getPartitions(table, partitionSpec);
-      if (partitions.size() > 1) {
-        throw new HiveException(ErrorMsg.TOO_MANY_COMPACTION_PARTITIONS);
-      } else if (partitions.isEmpty()) {
+      if (partitions.isEmpty()) {
         throw new HiveException(ErrorMsg.INVALID_PARTITION_SPEC);
       }
+      partitions = partitions.stream().filter(part -> part.getSpec().size() == 
partitionSpec.size()).collect(Collectors.toList());

Review Comment:
   could we please add this comment
   ````
   This validates that the partition spec given in the compaction command 
matches exactly one partition in the table, not a partial partition spec.
   ````



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

Reply via email to