@Test
  public void testHashIndexEquiJoinForMultipleResultQueryWithHashIndex() throws Exception {
    createReplicatedRegion("portfolios");
    createJoinTable(400);
    index = qs.createHashIndex("idHash", "p.ID", SEPARATOR + "portfolios p");
    Index index = qs.createHashIndex("index2", "p2.ID", SEPARATOR + "portfolios2 p2");

    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);
    }
    SelectResults results = (SelectResults) qs
        .newQuery("Select * FROM " + SEPARATOR + "portfolios p, " + SEPARATOR
            + "portfolios2 p2 where p.ID = 1 and p.ID = p2.ID")
        .execute();
    assertEquals(numEntries / numIds, results.size());
    assertTrue(observer.indexUsed);
  }
Tests that hash index is used and that it returns the correct number of results
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/HashIndexQueryIntegrationTest.java