void alterPartitions(List<Partition> newParts)
      throws MetaException, InvalidOperationException, NoSuchObjectException {
    //altering partitions in a batch must be transactional, therefore bofore starting the altering, clone the original
    //partitions map. If something fails, revert it back.
    Map<String, Partition> clonedPartitions = new LinkedHashMap<>();
    parts.forEach((key, value) -> clonedPartitions.put(key, new Partition(value)));
    for (Partition partition : newParts) {
      try {
        if (partition == null) {
          throw new InvalidOperationException("New partition cannot be null.");
        }
        alterPartition(partition.getValues(), partition, false);
      } catch (MetaException | InvalidOperationException | NoSuchObjectException e) {
        parts = clonedPartitions;
        throw e;
      }
    }
  }
Alter multiple partitions. This operation is transactional.
@param newParts list of new partitions, must be not null.
@throws MetaException table or db name is altered.
@throws InvalidOperationException the new partition values are null, or the old partition cannot be found.
@throws NoSuchObjectException the old partition cannot be found.
ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java