@Override
  protected void addPartition(IMetaStoreClient client, Table table,
      List<String> values) throws TException {
    PartitionBuilder partitionBuilder = new PartitionBuilder().inTable(table);
    values.forEach(val -> partitionBuilder.addValue(val));
    partParams.forEach((k, v) -> partitionBuilder.addPartParam(k, v));
    client.add_partition(partitionBuilder.build(getMetaStore().getConf()));
  }
Test class for list partitions with configurable include/exclude pattern on parameters.
Embedded Metastore uses JDO, Remote Metastore uses direct SQL to query the partitions:
MetaStoreFactoryForTests.getMetaStores()
ql/src/test/org/apache/hadoop/hive/metastore/TestListPartitionsWithXIncludeParams.java