private List<MRoleMap> listMSecurityPrincipalMembershipRole(final String roleName,
      final PrincipalType principalType) throws Exception {
    LOG.debug("Executing listMSecurityPrincipalMembershipRole");

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

    try (Query query = pm.newQuery(MRoleMap.class, "principalName == t1 && principalType == t2")) {
      query.declareParameters("java.lang.String t1, java.lang.String t2");
      final List<MRoleMap> mRoleMemebership = (List<MRoleMap>) query.execute(roleName, principalType.toString());

      LOG.debug("Retrieving all objects for listMSecurityPrincipalMembershipRole");
      pm.retrieveAll(mRoleMemebership);
      LOG.debug("Done retrieving all objects for listMSecurityPrincipalMembershipRole: {}", mRoleMemebership);

      return Collections.unmodifiableList(new ArrayList<>(mRoleMemebership));
    }
  }
Add role names of parentRoles and its parents to processedRoles
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java