public static List<Partition> getPartitionsByProjectSpec(IMetaStoreClient msc, GetPartitionsRequest request)
      throws MetastoreException {
    try {
      GetPartitionsResponse response = msc.getPartitionsWithSpecs(request);
      List<PartitionSpec> partitionSpecList = response.getPartitionSpec();
      List<Partition> result = new ArrayList<>();
      for (PartitionSpec spec : partitionSpecList) {
        if (spec.getPartitionList() != null && spec.getPartitionList().getPartitions() != null) {
          spec.getPartitionList().getPartitions().forEach(partition -> {
            partition.setCatName(spec.getCatName());
            partition.setDbName(spec.getDbName());
            partition.setTableName(spec.getTableName());
            result.add(partition);
          });
        }
        PartitionSpecWithSharedSD pSpecWithSharedSD = spec.getSharedSDPartitionSpec();
        if (pSpecWithSharedSD == null) {
          continue;
        }
        List<PartitionWithoutSD> withoutSDList = pSpecWithSharedSD.getPartitions();
        StorageDescriptor descriptor = pSpecWithSharedSD.getSd();
        if (withoutSDList != null) {
          for (PartitionWithoutSD psd : withoutSDList) {
            StorageDescriptor newSD = new StorageDescriptor(descriptor);
            Partition partition = new Partition(psd.getValues(), spec.getDbName(), spec.getTableName(),
                psd.getCreateTime(), psd.getLastAccessTime(), newSD, psd.getParameters());
            partition.getSd().setLocation(newSD.getLocation() + psd.getRelativePath());
            result.add(partition);
          }
        }
      }
      return result;
    } catch (Exception e) {
      throw new MetastoreException(e);
    }
  }
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