diff --git standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java index bc43f3d551..6e5b69350c 100644 --- standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java +++ standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestGetPartitionsUsingProjectionAndFilterSpecs.java @@ -860,16 +860,17 @@ private GetPartitionsRequest getGetPartitionsRequest() { private void verifyLocations(List origPartitions, StorageDescriptor sharedSD, List partitionWithoutSDS) { - int i=0; - for (Partition origPart : origPartitions) { + Assert.assertEquals("Partition count does not match", origPartitions.size(), partitionWithoutSDS.size()); + for (PartitionWithoutSD partitionWithoutSD : partitionWithoutSDS) { // in case of location sharedSD has the base location and partition has relative location - Assert.assertEquals("Location does not match", origPart.getSd().getLocation(), - sharedSD.getLocation() + partitionWithoutSDS.get(i).getRelativePath()); + long locationMatches = origPartitions.stream().filter(origPart -> + origPart.getSd().getLocation().equals(sharedSD.getLocation() + partitionWithoutSD.getRelativePath())) + .count(); + Assert.assertTrue("Location does not match", locationMatches > 0); Assert.assertNull("values were not requested but are still set", - partitionWithoutSDS.get(i).getValues()); + partitionWithoutSD.getValues()); Assert.assertNull("Parameters were not requested but are still set", - partitionWithoutSDS.get(i).getParameters()); - i++; + partitionWithoutSD.getParameters()); } }