@Test
  public void testDirectSQLDropPartitionsCacheCrossSession()
      throws Exception {
    ObjectStore objectStore2 = new ObjectStore();
    objectStore2.setConf(conf);

    createPartitionedTable(false, false);
    GetPartitionsArgs args = new GetPartitionsArgs.GetPartitionsArgsBuilder().max(10).build();
    // query the partitions with JDO in the 1st session
    List<Partition> partitions;
    try (AutoCloseable c = deadline()) {
      partitions = objectStore.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, false, true, args);
    }
    Assert.assertEquals(3, partitions.size());

    // query the partitions with JDO in the 2nd session
    try (AutoCloseable c = deadline()) {
      partitions = objectStore2.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, false, true, args);
    }
    Assert.assertEquals(3, partitions.size());

    // drop partitions with directSql in the 1st session
    try (AutoCloseable c = deadline()) {
      objectStore.dropPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1,
          Arrays.asList("test_part_col=a0", "test_part_col=a1"), true, false);
    }

    // query the partitions with JDO in the 2nd session, checking the cache is not causing any
    // problem
    try (AutoCloseable c = deadline()) {
      partitions = objectStore2.getPartitionsInternal(DEFAULT_CATALOG_NAME, DB1, TABLE1, false, true, args);
    }
    Assert.assertEquals(1, partitions.size());
  }
Checks if the JDO cache is able to handle directSQL partition drops cross sessions.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestObjectStore.java