Table tab = getTable(tblName);
Iterator<PartitionSpec> i;
int index;
for (i = partSpecs.iterator(), index = 1; i.hasNext(); ++index) {
PartitionSpec partSpec = i.next();
List<Partition> parts = null;
if (stringPartitionColumns) {
try {
parts = db.getPartitionsByFilter(tab, partSpec.toString());
} catch (Exception e) {
throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partSpec.toString()), e);
}
}
else {
try {
parts = db.getPartitions(tab, partSpec.getPartSpecWithoutOperator());
} catch (Exception e) {
throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partSpec.toString()), e);
}
}
if (parts.isEmpty()) {
if (throwIfNonExistent) {
throw new SemanticException(ErrorMsg.INVALID_PARTITION.getMsg(partSpec.toString()));
}
}
for (Partition p : parts) {
if (!ignoreProtection && !p.canDrop()) {
throw new SemanticException(