@Test
  public void testViewInSubQuery() throws Exception {
    String prefix = "tvsubquery" + NAME_PREFIX;
    final String tab1 = prefix + "t";
    final String view1 = prefix + "v";

    driver.run("create table " + tab1 + "(id int)");
    driver.run("create view " + view1 + " as select * from " + tab1);

    driver.compile("select * from " + view1, true);
    // view entity
    assertEquals("default@" + view1, CheckInputReadEntity.readEntities[0].getName());

    // table as second read entity
    assertEquals("default@" + tab1, CheckInputReadEntity.readEntities[1].getName());
    assertFalse("Table is not direct input", CheckInputReadEntity.readEntities[1].isDirect());

  }
Verify that the parent entities are captured correctly for view in subquery
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/plan/TestViewEntity.java