public List<Partition> getPartitionsAuthByNames(Table tbl, List<String> partNames, String userName,
      List<String> groupNames) throws HiveException {
    if (!tbl.isPartitioned()) {
      throw new HiveException(ErrorMsg.TABLE_NOT_PARTITIONED, tbl.getTableName());
    }
    GetPartitionsPsWithAuthRequest req = new GetPartitionsPsWithAuthRequest();
    req.setTblName(tbl.getTableName());
    req.setDbName(tbl.getDbName());
    req.setUserName(userName);
    req.setGroupNames(groupNames);
    req.setPartNames(partNames);
    if (AcidUtils.isTransactionalTable(tbl)) {
      ValidWriteIdList validWriteIdList = getValidWriteIdList(tbl.getDbName(), tbl.getTableName());
      req.setValidWriteIdList(validWriteIdList != null ? validWriteIdList.toString() : null);
      req.setId(tbl.getTTable().getId());
    }

    List<org.apache.hadoop.hive.metastore.api.Partition> tParts;
    try {
      GetPartitionsPsWithAuthResponse res = getMSC().listPartitionsWithAuthInfoRequest(req);
      tParts = res.getPartitions();
    } catch (Exception e) {
      throw new HiveException(e);
    }
    List<Partition> parts = new ArrayList<>(tParts.size());
    for (org.apache.hadoop.hive.metastore.api.Partition tpart : tParts) {
      parts.add(new Partition(tbl, tpart));
    }
    return parts;
  }
Get all partitions of the table that matches the list of given partition names.

@param tbl
         object for which partition is needed. Must be partitioned.
@param partNames
         list of partition names
@param getColStats
         if true, Partition object includes column statistics for that partition.
@return list of partition objects
@throws HiveException
ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java