private void addToMaterializationList(
          boolean expandGroupingSets, Materialization invalidationInfo, HiveRelOptMaterialization relOptMaterialization,
          List<HiveRelOptMaterialization> result) {
    if (expandGroupingSets) {
      List<HiveRelOptMaterialization> hiveRelOptMaterializationList =
              HiveMaterializedViewUtils.deriveGroupingSetsMaterializedViews(relOptMaterialization);
      if (invalidationInfo != null) {
        for (HiveRelOptMaterialization materialization : hiveRelOptMaterializationList) {
          result.add(materialization.updateInvalidation(invalidationInfo));
        }
      } else {
        result.addAll(hiveRelOptMaterializationList);
      }
    } else {
      result.add(invalidationInfo == null ? relOptMaterialization : relOptMaterialization.updateInvalidation(invalidationInfo));
    }
  }
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