private List<Partition> alterPartitionsViaJdo(MTable table, List<String> partNames,
                                                List<Partition> newParts, String queryWriteIdList)
      throws MetaException, InvalidObjectException {
    String catName = table.getDatabase().getCatalogName();
    String dbName = table.getDatabase().getName();
    String tblName = table.getTableName();
    List<Partition> results = new ArrayList<>(newParts.size());
    List<MPartition> mPartitionList;

    try (QueryWrapper query = new QueryWrapper(pm.newQuery(MPartition.class,
        "table.tableName == t1 && table.database.name == t2 && t3.contains(partitionName) " +
            " && table.database.catalogName == t4"))) {
      query.declareParameters("java.lang.String t1, java.lang.String t2, java.util.Collection t3, "
          + "java.lang.String t4");
      mPartitionList = (List<MPartition>) query.executeWithArray(tblName, dbName, partNames, catName);
      pm.retrieveAll(mPartitionList);

      if (mPartitionList.size() > newParts.size()) {
        throw new MetaException("Expecting only one partition but more than one partitions are found.");
      }

      Map<List<String>, MPartition> mPartsMap = new HashMap();
      for (MPartition mPartition : mPartitionList) {
        mPartsMap.put(mPartition.getValues(), mPartition);
      }

      Set<MColumnDescriptor> oldCds = new HashSet<>();
      Ref<MColumnDescriptor> oldCdRef = new Ref<>();
      for (Partition tmpPart : newParts) {
        oldCdRef.t = null;
        Partition result = alterPartitionNoTxn(catName, dbName, tblName,
            mPartsMap.get(tmpPart.getValues()), tmpPart, queryWriteIdList, oldCdRef, table);
        results.add(result);
        if (oldCdRef.t != null) {
          oldCds.add(oldCdRef.t);
        }
      }
      for (MColumnDescriptor oldCd : oldCds) {
        removeUnusedColumnDescriptor(oldCd);
      }
    }

    return results;
  }
Alters an existing partition. Initiates copy of SD. Returns the old CD.
@param part_vals Partition values (of the original partition instance)
@param newPart Partition object containing new information
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java