@Test
  public void testNonStandardPartitions() throws TException {
    String testTblName = "test_non_standard";
    new TableBuilder()
        .setTableName(testTblName)
        .setDbName(dbName)
        .addCol("ns_c1", "string", "comment 1")
        .addCol("ns_c2", "int", "comment 2")
        .addPartCol("part", "string")
        .addPartCol("city", "string")
        .addBucketCol("ns_c1")
        .addSortCol("ns_c2", 1)
        .addTableParam("tblparamKey", "Partitions of this table are not located within table directory")
        .create(client, conf);

    Table table = client.getTable(dbName, testTblName);
    Assert.assertNotNull("Unable to create a test table ", table);

    List<Partition> partitions = new ArrayList<>();
    partitions.add(createPartition(Arrays.asList("p1", "SanFrancisco"), table));
    partitions.add(createPartition(Arrays.asList("p1", "PaloAlto"), table));
    partitions.add(createPartition(Arrays.asList("p2", "Seattle"), table));
    partitions.add(createPartition(Arrays.asList("p2", "Phoenix"), table));

    client.add_partitions(partitions);
    // change locations of two of the partitions outside table directory
    List<Partition> testPartitions = client.listPartitions(dbName, testTblName, (short) -1);
    Assert.assertEquals(4, testPartitions.size());
    Partition p1 = testPartitions.get(2);
    p1.getSd().setLocation("/tmp/some_other_location/part=p2/city=Seattle");
    Partition p2 = testPartitions.get(3);
    p2.getSd().setLocation("/tmp/some_other_location/part=p2/city=Phoenix");
    client.alter_partitions(dbName, testTblName, Arrays.asList(p1, p2));

    GetPartitionsRequest request = getGetPartitionsRequest();
    request.getProjectionSpec().setFieldList(Arrays.asList("values", "sd"));
    request.setDbName(dbName);
    request.setTblName(testTblName);

    GetPartitionsResponse response = client.getPartitionsWithSpecs(request);
    Assert.assertNotNull("Response should have returned partition specs",
        response.getPartitionSpec());
    Assert
        .assertEquals("We should have two partition specs", 2, response.getPartitionSpec().size());
    Assert.assertNotNull("One SharedSD spec is expected",
        response.getPartitionSpec().get(0).getSharedSDPartitionSpec());
    Assert.assertNotNull("One composing spec is expected",
        response.getPartitionSpec().get(1).getPartitionList());

    PartitionSpecWithSharedSD partitionSpecWithSharedSD =
        response.getPartitionSpec().get(0).getSharedSDPartitionSpec();
    Assert.assertNotNull("sd was requested but not returned", partitionSpecWithSharedSD.getSd());
    Assert.assertEquals("shared SD should have table location", table.getSd().getLocation(),
        partitionSpecWithSharedSD.getSd().getLocation());
    List<List<String>> expectedVals = new ArrayList<>(2);
    expectedVals.add(Arrays.asList("p1", "PaloAlto"));
    expectedVals.add(Arrays.asList("p1", "SanFrancisco"));

    for (int i=0; i<partitionSpecWithSharedSD.getPartitions().size(); i++) {
      PartitionWithoutSD retPartition = partitionSpecWithSharedSD.getPartitions().get(i);
      Assert.assertEquals(2, retPartition.getValuesSize());
      validateList(expectedVals.get(i), retPartition.getValues());
      Assert.assertNull("parameters were not requested so should have been null",
          retPartition.getParameters());
    }

    PartitionListComposingSpec composingSpec =
        response.getPartitionSpec().get(1).getPartitionList();
    Assert.assertNotNull("composing spec should have returned 2 partitions",
        composingSpec.getPartitions());
    Assert.assertEquals("composing spec should have returned 2 partitions", 2,
        composingSpec.getPartitionsSize());

    expectedVals.clear();
    expectedVals.add(Arrays.asList("p2", "Phoenix"));
    expectedVals.add(Arrays.asList("p2", "Seattle"));
    for (int i=0; i<composingSpec.getPartitions().size(); i++) {
      Partition partition = composingSpec.getPartitions().get(i);
      Assert.assertEquals(2, partition.getValuesSize());
      validateList(expectedVals.get(i), partition.getValues());
      Assert.assertNull("parameters were not requested so should have been null",
          partition.getParameters());
    }
  }
Confirms if the partitionWithoutSD object at partitionWithoutSDSIndex index has all the
projected fields set to values which are same as the ones set in origPartitions
@param projectedFields
@param sharedSD
@param partitionWithoutSDS
@param partitionWithoutSDSIndex
@throws IllegalAccessException
@throws InvocationTargetException
@throws NoSuchMethodException
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java