private RelNode fail(RelNode node) {
    setResultCacheInvalidReason("Unsupported RelNode type " + node.getRelTypeName() +
        " encountered in the query plan");
    this.materializationValidationResult =
        new MaterializationValidationResult(EnumSet.noneOf(RewriteAlgorithm.class),
            String.format("Cannot enable automatic rewriting for materialized view. " +
                "Unsupported RelNode type %s encountered in the query plan", node.getRelTypeName()));
    throw Util.FoundOne.NULL;
  }
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