@Override
  public RelNode visit(HiveTableScan hiveScan) {
    RelOptHiveTable relOptHiveTable = (RelOptHiveTable) hiveScan.getTable();
    Table tab = relOptHiveTable.getHiveTableMD();
    if (tab.isTemporary()) {
      fail(tab.getTableName() + " is a temporary table");
    }
    if (tab.getTableType() == TableType.EXTERNAL_TABLE &&
        !(tab.getStorageHandler() != null && tab.getStorageHandler().areSnapshotsSupported())) {
      fail(tab.getFullyQualifiedName() + " is an external table and does not support snapshots");
    }
    return hiveScan;
  }
Checks the query plan for conditions that would make the plan unsuitable for
materialized views or query caching:
- References to temporary or external tables
- References to non-deterministic functions.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptMaterializationValidator.java