@Deprecated
  @Override
  public int add_partitions(final List<Partition> parts) throws MetaException,
      InvalidObjectException, AlreadyExistsException {
    if (parts == null) {
      throw new MetaException("Partition list cannot be null.");
    }
    if (parts.isEmpty()) {
      return 0;
    }
    String catName = parts.get(0).isSetCatName() ? parts.get(0).getCatName() : getDefaultCatalog(conf);
    String dbName = parts.get(0).getDbName();
    String tableName = parts.get(0).getTableName();
    startTableFunction("add_partitions", catName, dbName, tableName);

    Integer ret = null;
    Exception ex = null;
    try {
      // Old API assumed all partitions belong to the same table; keep the same assumption
      if (!parts.get(0).isSetCatName()) {
        parts.forEach(p -> p.setCatName(catName));
      }
      AddPartitionsRequest addPartitionsReq = new AddPartitionsRequest();
      addPartitionsReq.setDbName(parts.get(0).getDbName());
      addPartitionsReq.setTblName(parts.get(0).getTableName());
      addPartitionsReq.setParts(parts);
      addPartitionsReq.setIfNotExists(false);
      if (parts.get(0).isSetCatName()) {
        addPartitionsReq.setCatName(parts.get(0).getCatName());
      }
      ret = add_partitions_req(addPartitionsReq).getPartitions().size();
      assert ret == parts.size();
    } catch (Exception e) {
      ex = e;
      throw handleException(e)
          .throwIfInstance(MetaException.class, InvalidObjectException.class, AlreadyExistsException.class)
          .defaultMetaException();
    } finally {
      endFunction("add_partitions", ret != null, ex, tableName);
    }
    return ret;
  }
Create the location folders for the partitions. For each partition a separate thread will be
started to create the folder. The method will wait until all threads are finished and returns
the partitions whose folders were created successfully. If an error occurs during the
execution of a thread, a MetaException will be thrown.
@param partitionsToAdd
@param table
@param addedPartitions
@return
@throws MetaException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HMSHandler.java