SourabhBadhya commented on code in PR #5248:
URL: https://github.com/apache/hive/pull/5248#discussion_r1621788175
##########
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:
Shouldn't this ideally be part of the `getPartitions` call itself. If we are
passing exact partition specs then shouldn't `getPartitions` return the exact
partition corresponding to it and not the partial ones?
--
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]