@Override
  public List<String> isPartOfMaterializedView(String catName, String dbName, String tblName) {

    boolean committed = false;
    Query query = null;
    List<String> mViewList = new ArrayList<>();

    try {
      openTransaction();

      query = pm.newQuery("select from org.apache.hadoop.hive.metastore.model.MCreationMetadata");

      List<MCreationMetadata> creationMetadata = (List<MCreationMetadata>)query.execute();
      Iterator<MCreationMetadata> iter = creationMetadata.iterator();

      while (iter.hasNext())
      {
        MCreationMetadata p = iter.next();
        Set<MMVSource> tables = p.getTables();
        for (MMVSource sourceTable : tables) {
          MTable table = sourceTable.getTable();
          if (dbName.equals(table.getDatabase().getName())  && tblName.equals(table.getTableName())) {
            LOG.info("Cannot drop table " + table.getTableName() +
                    " as it is being used by MView " + p.getTblName());
            mViewList.add(p.getDbName() + "." + p.getTblName());
          }
        }
      }

      committed = commitTransaction();
    } finally {
      rollbackAndCleanup(committed, query);
    }
    return mViewList;
  }
Convert PrivilegeGrantInfo from privMap to MTablePrivilege, and add all of
them to the toPersistPrivObjs. These privilege objects will be persisted as
part of createTable.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java