@Test
  public void testBogusLevel() throws Exception {
    boolean sawException = false;
    try {
      parseAndAnalyze("alter table foo partition(ds = 'today') compact 'bogus'");
    } catch (SemanticException e) {
      sawException = true;
      Assert.assertEquals(ErrorMsg.INVALID_COMPACTION_TYPE.getMsg(), e.getMessage());
    }
    Assert.assertTrue(sawException);
  }
Tests for parsing and semantic analysis of ALTER TABLE ... compact.
ql/src/test/org/apache/hadoop/hive/ql/parse/TestQBCompact.java