@Override
  @InterfaceAudience.LimitedPrivate({"Hive"})
  @InterfaceStability.Evolving
  public HCatPartitionSpec getPartitionSpecs(String dbName, String tableName, int maxPartitions) throws HCatException {
    try {
      return new HCatPartitionSpec(getTable(dbName, tableName),
                                   hmsClient.listPartitionSpecs(dbName, tableName, maxPartitions));
    }
    catch (NoSuchObjectException e) {
      throw new ObjectNotFoundException(
          "NoSuchObjectException while retrieving partition.", e);
    } catch (MetaException e) {
      throw new HCatException(
          "MetaException while retrieving partition.", e);
    } catch (TException e) {
      throw new ConnectionFailureException(
          "TException while retrieving partition.", e);
    }
  }
The HCatClientHMSImpl is the Hive Metastore client based implementation of
HCatClient.
hcatalog/webhcat/java-client/src/main/java/org/apache/hive/hcatalog/api/HCatClientHMSImpl.java