void alterPartition(List<String> oldPartitionVals, Partition newPartition, boolean isRename)
      throws MetaException, InvalidOperationException, NoSuchObjectException {
    if (oldPartitionVals == null || oldPartitionVals.isEmpty()) {
      throw new InvalidOperationException("Old partition values cannot be null or empty.");
    }
    if (newPartition == null) {
      throw new InvalidOperationException("New partition cannot be null.");
    }
    Partition oldPartition = getPartition(oldPartitionVals);
    if (oldPartition == null) {
      throw new InvalidOperationException(
          "Partition with partition values " + Arrays.toString(oldPartitionVals.toArray()) + " is not found.");
    }
    if (!oldPartition.getDbName().equals(newPartition.getDbName())) {
      throw new MetaException("Db name cannot be altered.");
    }
    if (!oldPartition.getTableName().equals(newPartition.getTableName())) {
      throw new MetaException("Table name cannot be altered.");
    }
    if (isRename) {
      newPartition.getSd().setLocation(oldPartition.getSd().getLocation());
    }
    dropPartition(oldPartitionVals);
    String partName = makePartName(tTable.getPartitionKeys(), newPartition.getValues());
    if (parts.containsKey(partName)) {
      throw new InvalidOperationException("Partition " + partName + " already exists");
    }
    parts.put(partName, newPartition);
  }
Alter an existing partition. The flow is following:
<p>
  1) search for existing partition
  2) if found delete it
  3) insert new partition
</p>
@param oldPartitionVals the values of existing partition, which is altered, must be not null.
@param newPartition the new partition, must be not null.
@param isRename true, if rename is requested, meaning that all properties of partition can be changed, except
                of its location.
@throws MetaException table or db name is altered.
@throws InvalidOperationException the new partition values are null, or the old partition cannot be found.
ql/src/java/org/apache/hadoop/hive/ql/metadata/PartitionTree.java