@Test
  public void testSelectEntityInDirect() throws ParseException {
    Driver driver = createDriver();
    int ret = driver.compile("select * from v1", true);
    assertEquals("Checking command success", 0, ret);
    assertEquals(2, CheckInputReadEntityDirect.readEntities.size());
    for (ReadEntity readEntity : CheckInputReadEntityDirect.readEntities) {
      if (readEntity.getName().equals("default@t1")) {
        assertFalse("not direct", readEntity.isDirect());
      } else if (readEntity.getName().equals("default@v1")) {
        assertTrue("direct", readEntity.isDirect());
      } else {
        fail("unexpected entity name " + readEntity.getName());
      }
    }
  }
Underlying table of view should be marked as indirect

@throws ParseException
ql/src/test/org/apache/hadoop/hive/ql/plan/TestReadEntityDirect.java