private List<MDCPrivilege> listPrincipalAllDCGrant(String principalName, PrincipalType principalType)
          throws Exception {
    final List<MDCPrivilege> mSecurityDCList;

    LOG.debug("Executing listPrincipalAllDCGrant");

    Preconditions.checkState(this.currentTransaction.isActive());

    if (principalName != null && principalType != null) {
      try (Query query = pm.newQuery(MDCPrivilege.class, "principalName == t1 && principalType == t2")) {
        query.declareParameters("java.lang.String t1, java.lang.String t2");
        mSecurityDCList = (List<MDCPrivilege>) query.execute(principalName, principalType.toString());
        pm.retrieveAll(mSecurityDCList);
        LOG.debug("Done retrieving all objects for listPrincipalAllDCGrant: {}", mSecurityDCList);
        return Collections.unmodifiableList(new ArrayList<>(mSecurityDCList));
      }
    } else {
      try (Query query = pm.newQuery(MDCPrivilege.class)) {
        mSecurityDCList = (List<MDCPrivilege>) query.execute();
        pm.retrieveAll(mSecurityDCList);
        LOG.debug("Done retrieving all objects for listPrincipalAllDCGrant: {}", mSecurityDCList);
        return Collections.unmodifiableList(new ArrayList<>(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