private void helpTestHashIndexRemoveFromCommonKeyQuery() throws Exception {
    int numEntries = 200;
    int numIds = 100;
    for (int i = 0; i < numEntries; i++) {
      Portfolio p = new Portfolio(i % (numIds));
      p.shortID = (short) i;
      region.put("" + i, p);
    }
    Portfolio p2 = new Portfolio(10000);
    region.put("2", p2);
    p2.ID = 1000;
    region.put("2", p2);
    SelectResults noIndexResult =
        (SelectResults) qs.newQuery("Select * FROM " + SEPARATOR + "portfolios p where p.ID = 2")
            .execute();

    region.clear();
    index = qs.createHashIndex("idHash", "p.ID", SEPARATOR + "portfolios p");
    for (int i = 0; i < numEntries; i++) {
      Portfolio p = new Portfolio(i % (numIds));
      p.shortID = (short) i;
      region.put("" + i, p);
    }
    p2 = new Portfolio(10000);
    region.put("2", p2);
    p2.ID = 1000;
    region.put("2", p2);

    SelectResults results =
        (SelectResults) qs.newQuery("Select * FROM " + SEPARATOR + "portfolios p where p.ID = 2")
            .execute();
    assertEquals(numEntries / numIds - 1, results.size());
    assertEquals(noIndexResult.size(), results.size());
    assertTrue(observer.indexUsed);
  }
Tests that hash index is used and that the value is correctly removed from the index where
multiple entries are using the key on partitioned region
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/HashIndexQueryIntegrationTest.java