private void createTestTables() throws TException {
    if (client.tableExists(dbName, tblName)) {
      LOG.info("Table is already existing. Dropping it and then recreating");
      client.dropTable(dbName, tblName);
    }
    new TableBuilder().setTableName(tblName).setDbName(dbName).setCols(Arrays
        .asList(new FieldSchema("col1", "string", "c1 comment"),
            new FieldSchema("col2", "int", "c2 comment"))).setPartCols(Arrays
        .asList(new FieldSchema("state", "string", "state comment"),
            new FieldSchema("city", "string", "city comment")))
        .setTableParams(new HashMap<String, String>(2) {{
          put("tableparam1", "tableval1");
          put("tableparam2", "tableval2");
        }})
        .setBucketCols(Collections.singletonList("col1"))
        .addSortCol("col2", 1)
        .addSerdeParam(SERIALIZATION_FORMAT, "1").setSerdeName(tblName)
        .setSerdeLib("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe")
        .setInputFormat("org.apache.hadoop.hive.ql.io.HiveInputFormat")
        .setOutputFormat("org.apache.hadoop.hive.ql.io.HiveOutputFormat")
        .create(client, conf);

    Table table = client.getTable(dbName, tblName);
    Assert.assertTrue("Table " + dbName + "." + tblName + " does not exist",
        client.tableExists(dbName, tblName));

    List<Partition> partitions = new ArrayList<>();
    partitions.add(createPartition(Arrays.asList("CA", "SanFrancisco"), table));
    partitions.add(createPartition(Arrays.asList("CA", "PaloAlto"), table));
    partitions.add(createPartition(Arrays.asList("WA", "Seattle"), table));
    partitions.add(createPartition(Arrays.asList("AZ", "Phoenix"), table));

    client.add_partitions(partitions);
  }
Tests for getPartitionsWithSpecs metastore API. This test create some partitions and makes sure
that getPartitionsWithSpecs returns results which are comparable with the get_partitions API when
various combinations of projection spec are set. Also checks the JDO code path in addition to
directSQL code path
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java