public static void validateTablesUsed(SemanticAnalyzer analyzer) throws SemanticException {
    // Do not allow view to be defined on temp table or other materialized view
    for (TableScanOperator ts : analyzer.getTopOps().values()) {
      Table table = ts.getConf().getTableMetadata();
      if (SemanticAnalyzer.DUMMY_TABLE.equals(table.getTableName())) {
        continue;
      }

      if (table.isTemporary()) {
        throw new SemanticException("View definition references temporary table " + table.getCompleteName());
      }

      if (table.isMaterializedView()) {
        throw new SemanticException("View definition references materialized view " + table.getCompleteName());
      }
    }
  }
Abstract ancestor of analyzers that can create a view.
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/create/AbstractCreateViewAnalyzer.java