public Boolean isOutdatedMaterializedView(
      Table materializedViewTable, Set<TableName> tablesUsed, boolean forceMVContentsUpToDate,
      Supplier<String> validTxnsList, HiveTxnManager txnMgr) throws HiveException {
    long defaultTimeWindow = HiveConf.getTimeVar(conf,
        HiveConf.ConfVars.HIVE_MATERIALIZED_VIEW_REWRITING_TIME_WINDOW, TimeUnit.MILLISECONDS);

    // Check if materialization defined its own invalidation time window
    String timeWindowString = materializedViewTable.getProperty(MATERIALIZED_VIEW_REWRITING_TIME_WINDOW);
    long timeWindow = org.apache.commons.lang3.StringUtils.isEmpty(timeWindowString) ? defaultTimeWindow :
            HiveConf.toTime(timeWindowString,
                    HiveConf.getDefaultTimeUnit(HiveConf.ConfVars.HIVE_MATERIALIZED_VIEW_REWRITING_TIME_WINDOW),
                    TimeUnit.MILLISECONDS);
    MaterializedViewMetadata mvMetadata = materializedViewTable.getMVMetadata();
    boolean outdated = false;
    if (timeWindow < 0L) {
      // We only consider the materialized view to be outdated if forceOutdated = true, i.e.,
      // if it is a rebuild. Otherwise, it passed the test and we use it as it is.
      outdated = forceMVContentsUpToDate;
    } else {
      // Check whether the materialized view is invalidated
      if (forceMVContentsUpToDate || timeWindow == 0L ||
              mvMetadata.getMaterializationTime() < System.currentTimeMillis() - timeWindow) {
        return HiveMaterializedViewUtils.isOutdatedMaterializedView(
            validTxnsList, txnMgr, this, tablesUsed, materializedViewTable);
      }
    }
    return outdated;
  }
Utility method that returns whether a materialized view is outdated (true), not outdated
(false), or it cannot be determined (null). The latest case may happen e.g. when the
materialized view definition uses external tables.
This method checks invalidation time window defined in materialization.
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java