@Test
  public void testListPartitionNames() throws Exception {
    Table t = createTable4PartColsParts(getClient()).table;
    String defaultPartitionName = HiveConf.getVar(conf, HiveConf.ConfVars.DEFAULT_PARTITION_NAME);
    List<List<String>> testValues = Lists.newArrayList(
        Lists.newArrayList("1999", defaultPartitionName, "02"),
        Lists.newArrayList(defaultPartitionName, "02", "10"),
        Lists.newArrayList("2017", "10", defaultPartitionName));

    for(List<String> vals : testValues) {
      addPartition(getClient(), t, vals);
    }
    TestMetastoreExpr.ExprBuilder e = new TestMetastoreExpr.ExprBuilder(TABLE_NAME);
    checkPartitionNames(Lists.newArrayList("yyyy=2017/mm=10/dd=26",
        "yyyy=2017/mm=10/dd=__HIVE_DEFAULT_PARTITION__",
        "yyyy=2017/mm=11/dd=27"),
        (short)3, null, defaultPartitionName,
        e.val("2017").strCol("yyyy").pred(">=", 2).build(), t);

    checkPartitionNames(Lists.newArrayList(
        "yyyy=2017/mm=11/dd=27",
        "yyyy=2017/mm=10/dd=26"),
        (short)2, "1,2:-+", defaultPartitionName,
        e.val("2017").strCol("yyyy").pred(">=", 2).build(), t);

    checkPartitionNames(Lists.newArrayList("yyyy=1999/mm=01/dd=02",
        "yyyy=1999/mm=__HIVE_DEFAULT_PARTITION__/dd=02",
        "yyyy=2009/mm=02/dd=10"),
        (short)3, null, defaultPartitionName, null, t);

    checkPartitionNames(Lists.newArrayList("yyyy=__HIVE_DEFAULT_PARTITION__/mm=02/dd=10",
        "yyyy=2017/mm=10/dd=26",
        "yyyy=2017/mm=10/dd=__HIVE_DEFAULT_PARTITION__"),
        (short)3, "0,1:-+", defaultPartitionName, null, t);

    checkPartitionNames(Lists.newArrayList("yyyy=1999/mm=01/dd=02",
        "yyyy=1999/mm=__HIVE_DEFAULT_PARTITION__/dd=02",
        "yyyy=2009/mm=02/dd=10"),
        (short)3, null, defaultPartitionName, null, t);
  }
Test class for list partitions related methods on temporary tables.
ql/src/test/org/apache/hadoop/hive/ql/metadata/TestSessionHiveMetastoreClientListPartitionsTempTable.java