@Test
  public void testBug40441() throws Exception {
    CacheUtils.startCache();
    final Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    RegionAttributes ra = attributesFactory.create();
    final Region region = cache.createRegion("new_pos", ra);
    String queryStr1 = " select distinct r.name, pVal, r.\"type\"  "
        + " from " + SEPARATOR + "new_pos r , r.positions.values pVal where "
        + " ( r.undefinedTestField.toString = UNDEFINED  OR false ) ";// AND pVal.mktValue = 1.00";
    String queryStr2 = " select distinct r.name, pVal, r.\"type\"  "
        + " from " + SEPARATOR + "new_pos r , r.positions.values pVal where "
        + " ( r.undefinedTestField.toString = UNDEFINED  AND true ) AND pVal.mktValue = 1.00";
    final QueryService qs = CacheUtils.getQueryService();
    for (int i = 1; i < 100; ++i) {
      NewPortfolio pf = new NewPortfolio("name" + i, i);
      region.put("name" + i, pf);
    }

    Index indx1 = qs.createIndex("MarketValues", IndexType.FUNCTIONAL, "itr2.mktValue",
        SEPARATOR + "new_pos itr1, itr1.positions.values itr2");
    Index indx2 =
        qs.createIndex("Name", IndexType.FUNCTIONAL, "itr1.name", SEPARATOR + "new_pos itr1");
    Index indx3 = qs.createIndex("nameIndex", IndexType.PRIMARY_KEY, "name", SEPARATOR + "new_pos");
    Index indx4 = qs.createIndex("idIndex", IndexType.FUNCTIONAL, "id", SEPARATOR + "new_pos");
    Index indx5 =
        qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status", SEPARATOR + "new_pos");
    Index indx6 = qs.createIndex("undefinedFieldIndex", IndexType.FUNCTIONAL,
        "undefinedTestField.toString", SEPARATOR + "new_pos");
    final Query q1 = qs.newQuery(queryStr1);
    final Query q2 = qs.newQuery(queryStr2);
    SelectResults sr1 = (SelectResults) q1.execute();
    SelectResults sr2 = (SelectResults) q2.execute();
  }
Commented the test as it is for some reason causing OOM when run in the suite. It is due to
presence of PR Tests the where clause formed with CompiledComparison nesting with CompiledIN
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/MiscJUnitTest.java