@Test
  public void testQueryMethod_2() throws Exception {
    QueryService qs;
    qs = CacheUtils.getQueryService();
    AbstractIndex i1 =
        (AbstractIndex) qs.createIndex("idIndex", IndexType.FUNCTIONAL, "ID",
            SEPARATOR + "portfolios");
    AbstractIndex i2 = (AbstractIndex) qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "status",
        SEPARATOR + "portfolios");
    AbstractIndex i3 = (AbstractIndex) qs.createIndex("status.toString()", IndexType.FUNCTIONAL,
        "status.toString", SEPARATOR + "portfolios");

    Set results = new HashSet();
    DefaultQuery q = new DefaultQuery("select * from " + SEPARATOR + "portfolios  ",
        CacheUtils.getCache(), false);
    q.setRemoteQuery(false);
    ExecutionContext context = new QueryExecutionContext(null, CacheUtils.getCache(), q);
    bindIterators(context, SEPARATOR + "portfolios");
    Set keysToRemove = new HashSet();
    i1.query(1, OQLLexerTokenTypes.TOK_EQ, results, context);
    assertEquals(1, results.size());
    assertTrue(results.iterator().next() == region.get(1));
    results.clear();
    keysToRemove.clear();
    keysToRemove.add(1);
    try {
      i1.query(1, OQLLexerTokenTypes.TOK_EQ, results, keysToRemove, context);
      fail(
          "A condition having an  equal will be identified at RangeJunction level itself, so this type of condition should throw error in RangeIndex where along with an equal there happens not equal conditions");
    } catch (AssertionError error) {
      // pass
    }
    keysToRemove.clear();
    results.clear();
    keysToRemove.add(9);
    i1.query(1, OQLLexerTokenTypes.TOK_GT, results, keysToRemove, context);
    assertEquals(9, results.size());
    for (int i = 2; i < 12;) {
      if (i != 9) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    keysToRemove.clear();
    results.clear();
    keysToRemove.add(1);
    keysToRemove.add(10);
    i1.query(1, OQLLexerTokenTypes.TOK_GE, results, keysToRemove, context);
    assertEquals(9, results.size());
    for (int i = 2; i < 12;) {
      if (i != 10) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    keysToRemove.clear();
    results.clear();
    keysToRemove.add(8);
    keysToRemove.add(11);
    i1.query(11, OQLLexerTokenTypes.TOK_LT, results, keysToRemove, context);
    assertEquals(10, results.size());
    for (int i = 0; i < 11;) {
      if (i != 8) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    keysToRemove.clear();
    results.clear();
    keysToRemove.add(8);
    keysToRemove.add(11);
    i1.query(11, OQLLexerTokenTypes.TOK_LE, results, keysToRemove, context);
    assertEquals(10, results.size());
    for (int i = 0; i < 11;) {
      if (i != 8) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }

    keysToRemove.clear();
    results.clear();
    keysToRemove.add(1);
    keysToRemove.add(10);
    i1.query(1, OQLLexerTokenTypes.TOK_GT, results, keysToRemove, context);
    assertEquals(9, results.size());
    for (int i = 2; i < 12;) {
      if (i != 10) {
        assertTrue(results.contains(region.get(i)));
      }
      ++i;
    }
  }
The keysToRemove set will never contain null or UNDEFINED as those conditions never form part
of RangeJunctionCondnEvaluator. Such null or undefined conditions are treated as separate
filter operands. This test checks the query method of Index which takes a set of keys which
need to be removed from the set
geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/RangeIndexAPIJUnitTest.java