private List<HiveRelOptMaterialization> filterAugmentMaterializedViews (
      List<HiveRelOptMaterialization> materializedViews, Set<TableName> tablesUsed,
      Supplier<String> validTxnsList, HiveTxnManager txnMgr) throws HiveException {
    final boolean tryIncrementalRewriting =
        HiveConf.getBoolVar(conf, HiveConf.ConfVars.HIVE_MATERIALIZED_VIEW_REWRITING_INCREMENTAL);
    try {
      // Final result
      List<HiveRelOptMaterialization> result = new ArrayList<>();
      for (HiveRelOptMaterialization materialization : materializedViews) {
        final Table materializedViewTable = extractTable(materialization);
        final Boolean outdated = isOutdatedMaterializedView(
            materializedViewTable, tablesUsed, false, validTxnsList, txnMgr);
        if (outdated == null) {
          continue;
        }

        if (outdated) {
          // The MV is outdated, see whether we should consider it for rewriting or not
          if (!tryIncrementalRewriting) {
            LOG.debug("Materialized view " + materializedViewTable.getFullyQualifiedName() +
                " ignored for rewriting as its contents are outdated");
            continue;
          }
          // We will rewrite it to include the filters on transaction list
          // so we can produce partial rewritings.
          // This would be costly since we are doing it for every materialized view
          // that is outdated, but it only happens for more than one materialized view
          // if rewriting with outdated materialized views is enabled (currently
          // disabled by default).
          materialization = HiveMaterializedViewUtils.augmentMaterializationWithTimeInformation(
              materialization, validTxnsList, 
              materializedViewTable.getMVMetadata().getSnapshot());
        }
        result.addAll(HiveMaterializedViewUtils.deriveGroupingSetsMaterializedViews(materialization));
      }
      return result;
    } catch (Exception e) {
      throw new HiveException(e);
    }
  }
Get the materialized views that have been enabled for rewriting from the
cache (registry). It will preprocess them to discard those that are
outdated and augment those that need to be augmented, e.g., if incremental
rewriting is enabled.

@return the list of materialized views available for rewriting from the registry
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java