public Path getPartitionPath(Database db, Table table, List<String> vals)
      throws MetaException {
    List<FieldSchema> partKeys = table.getPartitionKeys();
    if (partKeys == null || (partKeys.size() != vals.size())) {
      throw new MetaException("Invalid number of partition keys found for " + table.getTableName());
    }
    Map<String, String> pm = new LinkedHashMap<>(vals.size());
    int i = 0;
    for (FieldSchema key : partKeys) {
      pm.put(key.getName(), vals.get(i));
      i++;
    }

    if (table.getSd().getLocation() != null) {
      return getPartitionPath(getDnsPath(new Path(table.getSd().getLocation())), pm);
    } else {
      return getDefaultPartitionPath(db, table, pm);
    }
  }
Given a database, a table and the partition key value pairs this method returns the Path object
corresponding to the partition key value pairs. It uses the table location if available else
uses the database location for constructing the path corresponding to the partition key-value
pairs

@param db - Parent database of the given table
@param table - Table for which the partition key-values are given
@param vals - List of values for the partition keys
@return Path corresponding to the partition key-value pairs
@throws MetaException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/Warehouse.java