@Override
  public int add_partitions_pspec(PartitionSpecProxy partitionSpec) throws TException {
    if (partitionSpec == null) {
      throw new MetaException("PartitionSpec cannot be null.");
    }
    if (partitionSpec.size() == 0) {
      return 0;
    }

    org.apache.hadoop.hive.metastore.api.Table table =
        getTempTable(partitionSpec.getDbName(), partitionSpec.getTableName());
    if (table == null) {
      return super.add_partitions_pspec(partitionSpec);
    }
    assertTempTablePartitioned(table);
    PartitionSpecProxy.PartitionIterator partitionIterator = partitionSpec.getPartitionIterator();
    List<Partition> partitionsToAdd = new ArrayList<>(partitionSpec.size());
    while (partitionIterator.hasNext()) {
      partitionsToAdd.add(partitionIterator.next());
    }

    List<Partition> addedPartitions = addPartitionsToTempTable(partitionsToAdd, partitionSpec.getDbName(),
        partitionSpec.getTableName(), false);
    if (addedPartitions != null) {
      return addedPartitions.size();
    }

    return super.add_partitions_pspec(partitionSpec);
  }
Loading Dynamic Partitions calls this. The partitions which are loaded, must belong to the
same table.
@param partitions the new partitions to be added, must be not null
@return number of partitions that were added
@throws TException
ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java