public static Partition getPartition(IMetaStoreClient msc, Table tbl, Map<String, String> partSpec) throws MetastoreException {
    List<String> pvals = new ArrayList<String>();
    for (FieldSchema field : getPartCols(tbl)) {
      String val = partSpec.get(field.getName());
      pvals.add(val);
    }
    Partition tpart = null;
    try {
      tpart = msc.getPartition(tbl.getCatName(), tbl.getDbName(), tbl.getTableName(), pvals);
    } catch (NoSuchObjectException nsoe) {
      // this means no partition exists for the given partition
      // key value pairs - thrift cannot handle null return values, hence
      // getPartition() throws NoSuchObjectException to indicate null partition
    } catch (Exception e) {
      LOG.error("Failed to get partition", e);
      throw new MetastoreException(e);
    }

    return tpart;
  }
This class is used to group the partitions based on a shared storage descriptor.
The following fields are considered for hashing/equality:
<ul>
  <li>location</li>
  <li>serializationLib</li>
  <li>inputFormat</li>
  <li>outputFormat</li>
  <li>columns</li>
</ul>

For objects that share these can share the same storage descriptor,
significantly reducing on-the-wire cost.

Check {@link #getPartitionspecsGroupedByStorageDescriptor} for more details
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/utils/MetaStoreServerUtils.java