private List<MDCPrivilege> listPrincipalMDCGrants(String principalName,
                                                    PrincipalType principalType, String dcName, String authorizer) {
    boolean success = false;
    Query query = null;
    List<MDCPrivilege> mSecurityDCList = new ArrayList<>();
    dcName = normalizeIdentifier(dcName);
    try {
      LOG.debug("Executing listPrincipalDCGrants");

      openTransaction();
      List<MDCPrivilege> mPrivs;
      if (authorizer != null) {
        query = pm.newQuery(MDCPrivilege.class,
                "principalName == t1 && principalType == t2 && dataConnector.name == t3 && " +
                        "authorizer == t4");
        query.declareParameters(
                "java.lang.String t1, java.lang.String t2, java.lang.String t3, "
                        + "java.lang.String t4");
        mPrivs = (List<MDCPrivilege>) query.executeWithArray(principalName, principalType.toString(),
                dcName, authorizer);
      } else {
        query = pm.newQuery(MDCPrivilege.class,
                "principalName == t1 && principalType == t2 && dataConnector.name == t3");
        query.declareParameters(
                "java.lang.String t1, java.lang.String t2, java.lang.String t3");
        mPrivs = (List<MDCPrivilege>) query.executeWithArray(principalName, principalType.toString(), dcName);
      }
      pm.retrieveAll(mPrivs);
      success = commitTransaction();

      mSecurityDCList.addAll(mPrivs);
      LOG.debug("Done retrieving all objects for listPrincipalDCGrants");
    } finally {
      rollbackAndCleanup(success, query);
    }
    return mSecurityDCList;
  }
Add role names of parentRoles and its parents to processedRoles
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java