private boolean isViewTable(String catName, String dbName, String tblName) throws MetaException {
    String queryText = "select \"TBL_TYPE\" from " + TBLS + "" +
        " inner join " + DBS + " on " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" " +
        " where " + TBLS + ".\"TBL_NAME\" = ? and " + DBS + ".\"NAME\" = ? and " + DBS + ".\"CTLG_NAME\" = ?";
    try (QueryWrapper query = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", queryText))) {
      Object[] params = new Object[] { tblName, dbName, catName };
      query.setUnique(true);
      Object result = executeWithArray(query.getInnerQuery(), params, queryText);
      return (result != null) && result.toString().equals(TableType.VIRTUAL_VIEW.toString());
    }
  }
Gets all partitions of a table by using direct SQL queries.
@param catName Metastore catalog name.
@param dbName Metastore db name.
@param tblName Metastore table name.
@param args additional arguments for getting partitions
@return List of partitions.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java