public HiveRelOptMaterialization getMaterializedViewForRebuild(
      String dbName, String materializedViewName, Set<TableName> tablesUsed,
      Supplier<String> validTxnsList, HiveTxnManager txnMgr) throws HiveException {
    List<HiveRelOptMaterialization> validMaterializedViews = getValidMaterializedViews(
        ImmutableList.of(getTable(dbName, materializedViewName)), tablesUsed, true, false, 
        validTxnsList, txnMgr, ALL);
    if (validMaterializedViews.isEmpty()) {
      return null;
    }
    Preconditions.checkState(validMaterializedViews.size() == 1,
        "Returned more than a materialized view for rebuild");
    return validMaterializedViews.get(0);
  }
Get the target materialized view from the metastore. Although it may load the plan
from the registry, it is guaranteed that it will always return an up-to-date version
wrt metastore.

@return the materialized view for rebuild
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java