@Override
  public int execute() throws HiveException {
    if (context.getContext().getExplainAnalyze() == AnalyzeState.RUNNING) {
      return 0;
    }

    try {
      if (desc.isRetrieveAndInclude()) {
        Table mvTable = context.getDb().getTable(desc.getName());
        HiveMaterializedViewsRegistry.get().createMaterializedView(context.getDb().getConf(), mvTable);
      } else if (desc.isDisableRewrite()) {
        // Disabling rewriting, removing from cache
        String[] names = desc.getName().split("\\.");
        HiveMaterializedViewsRegistry.get().dropMaterializedView(names[0], names[1]);
      } else if (desc.isUpdateCreationMetadata()) {
        // We need to update the status of the creation signature
        Table mvTable = context.getDb().getTable(desc.getName());
        MaterializedViewMetadata newMetadata = mvTable.getMVMetadata().reset(
                getSnapshotOf(context, mvTable.getMVMetadata().getSourceTableNames()));
        context.getDb().updateCreationMetadata(mvTable.getDbName(), mvTable.getTableName(), newMetadata);
        mvTable.setMaterializedViewMetadata(newMetadata);
        HiveMaterializedViewsRegistry.get().refreshMaterializedView(context.getDb().getConf(), mvTable);
      }
    } catch (HiveException e) {
      LOG.debug("Exception during materialized view cache update", e);
      context.getTask().setException(e);
    }

    return 0;
  }
Operation process of updating a materialized view.
ql/src/java/org/apache/hadoop/hive/ql/ddl/view/materialized/update/MaterializedViewUpdateOperation.java