public List<String> getTablesByType(String dbName, String pattern, TableType type)
      throws HiveException {
    PerfLogger perfLogger = SessionState.getPerfLogger();
    perfLogger.perfLogBegin(CLASS_NAME, PerfLogger.HIVE_GET_TABLE);

    if (dbName == null) {
      dbName = SessionState.get().getCurrentDatabase();
    }

    try {
      List<String> result;
      if (type != null) {
        if (pattern != null) {
          result = getMSC().getTables(dbName, pattern, type);
        } else {
          result = getMSC().getTables(dbName, ".*", type);
        }
      } else {
        if (pattern != null) {
          result = getMSC().getTables(dbName, pattern);
        } else {
          result = getMSC().getTables(dbName, ".*");
        }
      }
      return result;
    } catch (Exception e) {
      throw new HiveException(e);
    } finally {
      perfLogger.perfLogEnd(CLASS_NAME, PerfLogger.HIVE_GET_TABLE, "HS2-cache");
    }
  }
Returns all existing tables of a type (VIRTUAL_VIEW|EXTERNAL_TABLE|MANAGED_TABLE) from the specified
database which match the given pattern. The matching occurs as per Java regular expressions.
@param dbName Database name to find the tables in. if null, uses the current database in this session.
@param pattern A pattern to match for the table names.If null, returns all names from this DB.
@param type The type of tables to return. VIRTUAL_VIEWS for views. If null, returns all tables and views.
@return list of table names that match the pattern.
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java