@Test
  public void testPartitionFilterLike() throws Exception {
    String dbName = "filterdb";
    String tblName = "filtertbl";

    List<String> vals = new ArrayList<>(1);
    vals.add("abc");
    List <String> vals2 = new ArrayList<>(1);
    vals2.add("d_\\\\%ae");
    List <String> vals3 = new ArrayList<>(1);
    vals3.add("af%");

    silentDropDatabase(dbName);

    new DatabaseBuilder()
        .setName(dbName)
        .create(client, conf);

    Table tbl = new TableBuilder()
        .setDbName(dbName)
        .setTableName(tblName)
        .addCol("c1", ColumnType.STRING_TYPE_NAME)
        .addCol("c2", ColumnType.INT_TYPE_NAME)
        .addPartCol("p1", ColumnType.STRING_TYPE_NAME)
        .create(client, conf);

    tbl = client.getTable(dbName, tblName);

    add_partition(client, tbl, vals, "part1");
    add_partition(client, tbl, vals2, "part2");
    add_partition(client, tbl, vals3, "part3");

    checkFilter(client, dbName, tblName, "p1 like \"a%\"", 2);
    checkFilter(client, dbName, tblName, "p1 like \"%a%\"", 3);
    checkFilter(client, dbName, tblName, "p1 like \"%a\"", 0);
    checkFilter(client, dbName, tblName, "p1 like \"a%c\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%a%c%\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%_b%\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%b_\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%c\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%c%\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"c%\"", 0);
    checkFilter(client, dbName, tblName, "p1 like \"%\\_%\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%\\%%\"", 2);
    checkFilter(client, dbName, tblName, "p1 like \"abc\"", 1);
    checkFilter(client, dbName, tblName, "p1 like \"%\"", 3);
    checkFilter(client, dbName, tblName, "p1 like \"_\"", 0);
    checkFilter(client, dbName, tblName, "p1 like \"___\"", 2);
    checkFilter(client, dbName, tblName, "p1 like \"%%%\"", 3);
    checkFilter(client, dbName, tblName, "p1 like \"%\\\\\\\\%\"", 1);

    client.dropTable(dbName, tblName);
    client.dropDatabase(dbName);
  }
Test "like" filtering on table with single partition.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java