private boolean isMaterializedViewRewritingByTextEnabled() {
      return conf.getBoolVar(ConfVars.HIVE_MATERIALIZED_VIEW_ENABLE_AUTO_REWRITING_SQL) &&
              !HiveMaterializedViewsRegistry.get().isEmpty() &&
              mvRebuildMode == MaterializationRebuildMode.NONE &&
              !rootQB.isMaterializedView() && !ctx.isLoadingMaterializedView() && !rootQB.isCTAS() &&
              rootQB.getIsQuery() &&
              rootQB.hasTableDefined() &&
              !forViewCreation;
    }
@return whether the specified cte fulfills all preconditions for materialization.
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java