public Collection<SQLPrivTypeGrant> findMissingPrivs(RequiredPrivileges availPrivs) {
    MissingPrivilegeCapturer missingPrivCapturer = new MissingPrivilegeCapturer();
    if(availPrivs == null ){
      availPrivs = new RequiredPrivileges(); //create an empty priv set
    }

    if(availPrivs.privilegeGrantSet.contains(SQLPrivTypeGrant.ADMIN_PRIV)){
      //you are an admin! You have all privileges, no missing privileges
      return missingPrivCapturer.getMissingPrivileges();
    }
    // check the mere mortals!
    for (SQLPrivTypeGrant requiredPriv : privilegeGrantSet) {
      if (!availPrivs.privilegeGrantSet.contains(requiredPriv)) {
        missingPrivCapturer.addMissingPrivilege(requiredPriv);
      }
    }
    return missingPrivCapturer.getMissingPrivileges();
  }
Find the missing privileges in availPrivs

@param availPrivs
         - available privileges
@return missing privileges as RequiredPrivileges object
ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/RequiredPrivileges.java