HCatPartition getHCatPartition(HCatTable hcatTable) throws HCatException {
    assert hcatPartition == null : "hcatPartition should have been null at this point.";
    assert dbName.equalsIgnoreCase(hcatTable.getDbName()) : "DB names don't match.";
    assert tableName.equalsIgnoreCase(hcatTable.getTableName()) : "Table names don't match.";
    return new HCatPartition(hcatTable, partitionKeyValues, location);
  }
The Class HCatAddPartitionDesc helps users in defining partition attributes.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatAddPartitionDesc.java