@Test
  public void oqlQueryShouldNotThrowClassCastException() throws Exception {
    // Create Index.
    try {
      qs.createIndex("pos1_secIdIndex", IndexType.FUNCTIONAL, "p1.position1.secId",
          SEPARATOR + "pos1 p1");
      qs.createIndex("pos1_IdIndex", IndexType.FUNCTIONAL, "p1.position1.Id",
          SEPARATOR + "pos1 p1");
      qs.createIndex("pos_IdIndex", IndexType.FUNCTIONAL, "p.position1.Id",
          SEPARATOR + "pos p");
    } catch (Exception ex) {
      fail("Failed to create Index. " + ex);
    }
    // Execute Query.
    try {
      String queryStr =
          "select distinct * from " + SEPARATOR + "pos p, " + SEPARATOR + "pos1 p1 where "
              + "p.position1.Id = p1.position1.Id and p1.position1.secId in set('MSFT')";
      Query q = qs.newQuery(queryStr);
      CacheUtils.getLogger().fine("Executing:" + queryStr);
      q.execute();
    } catch (Exception ex) {
      fail("Query should have executed successfully. " + ex);
    }
  }
TRAC #41509: ClassCastException running an OQL query
geode-core/src/integrationTest/java/org/apache/geode/cache/query/QueryServiceRegressionTest.java