@Override
  public List<String> getTables(String dbName, String tablePattern) throws MetaException {
    List<String> tableNames = super.getTables(dbName, tablePattern);

    // May need to merge with list of temp tables
    dbName = dbName.toLowerCase();
    tablePattern = tablePattern.toLowerCase();
    Map<String, Table> tables = getTempTablesForDatabase(dbName, tablePattern);
    if (tables == null || tables.size() == 0) {
      return tableNames;
    }
    tablePattern = tablePattern.replaceAll("(?<!\\.)\\*", ".*");
    Pattern pattern = Pattern.compile(tablePattern);
    Matcher matcher = pattern.matcher("");
    Set<String> combinedTableNames = new HashSet<String>();
    for (String tableName : tables.keySet()) {
      matcher.reset(tableName);
      if (matcher.matches()) {
        combinedTableNames.add(tableName);
      }
    }

    // Combine/sort temp and normal table results
    combinedTableNames.addAll(tableNames);
    tableNames = new ArrayList<String>(combinedTableNames);
    Collections.sort(tableNames);
    return tableNames;
  }
todo: This need review re: thread safety.  Various places (see callsers of
{@link SessionState#setCurrentSessionState(SessionState)}) pass SessionState to forked threads.
Currently it looks like those threads only read metadata but this is fragile.
Also, maps (in SessionState) where tempt table metadata is stored are concurrent and so
any put/get crosses a memory barrier and so does using most {@code java.util.concurrent.*}
so the readers of the objects in these maps should have the most recent view of the object.
But again, could be fragile.
ql/src/java/org/apache/hadoop/hive/ql/metadata/SessionHiveMetaStoreClient.java