public List<String> getTables(String catName, String dbName, TableType tableType, int limit)
      throws MetaException {
    String queryText = "SELECT " + TBLS + ".\"TBL_NAME\""
      + " FROM " + TBLS + " "
      + " INNER JOIN " + DBS + " ON " + TBLS + ".\"DB_ID\" = " + DBS + ".\"DB_ID\" "
      + " WHERE " + DBS + ".\"NAME\" = ? AND " + DBS + ".\"CTLG_NAME\" = ? "
      + (tableType == null ? "" : "AND " + TBLS + ".\"TBL_TYPE\" = ? ") ;


    List<String> pms = new ArrayList<>();
    pms.add(dbName);
    pms.add(catName);
    if (tableType != null) {
      pms.add(tableType.toString());
    }

    try (QueryWrapper queryParams = new QueryWrapper(pm.newQuery("javax.jdo.query.SQL", queryText))) {
      List<String> tableNames = executeWithArray(
          queryParams.getInnerQuery(), pms.toArray(), queryText, limit);
      List<String> results = new ArrayList<String>(tableNames);
      return results;
    }
  }
Get table names by using direct SQL queries.
@param catName catalog name
@param dbName Metastore database namme
@param tableType Table type, or null if we want to get all tables
@return list of table names
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/MetaStoreDirectSql.java