private List<Partition> buildPartitions(String dbName, String tableName, List<String> values)
      throws MetaException {

    String tableLocation = metaStore.getWarehouseRoot() + "/" + tableName;
    List<Partition> partitions = new ArrayList<>();

    for (String value : values) {
      Partition partition =
          buildPartition(dbName, tableName, value, tableLocation + "/year=" + value);
      partitions.add(partition);
    }
    return partitions;
  }
Tests for creating partitions from partition spec.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAddPartitionsFromPartSpec.java