@Override
  public IndexInfo[] getIndexInfo(ExecutionContext context)
      throws TypeMismatchException, NameResolutionException {
    IndexInfo[] indexInfo = privGetIndexInfo(context);
    if (indexInfo != null) {
      if (indexInfo == NO_INDEXES_IDENTIFIER) {
        return null;
      } else {
        return indexInfo;
      }
    }
    if (!IndexUtils.indexesEnabled) {
      return null;
    }
    // TODO:Asif : Check if the condition is such that Primary Key Index is used
    // & its key is DEFINED
    // , then are we returning all the values of the region ?
    // & that if the key is UNDEFINED are we returning an empty set.?
    IndexData indexData =
        QueryUtils.getAvailableIndexIfAny(_value, context, _is_defined ? TOK_NE : TOK_EQ);
    IndexProtocol index = null;
    IndexInfo[] newIndexInfo = null;
    if (indexData != null) {
      index = indexData.getIndex();
    }
    if (index != null && index.isValid()) {
      newIndexInfo = new IndexInfo[1];
      /*
       * Pass the Key as null as the key is not of type CompiledValue( but of type
       * QueryService.UNDEFINED)
       */
      newIndexInfo[0] = new IndexInfo(null, _value, index, indexData.getMatchLevel(),
          indexData.getMapping(), _is_defined ? TOK_NE : TOK_EQ);
    }
    if (newIndexInfo != null) {
      privSetIndexInfo(newIndexInfo, context);
    } else {
      privSetIndexInfo(NO_INDEXES_IDENTIFIER, context);
    }
    return newIndexInfo;
  }
evaluate as a filter, producing an intermediate result set. This may require iteration if there
is no index available. Asif :The boolean true implies that CompiledComparsion when existing on
its own always requires a Complete expansion to top level iterators. This flag can get toggled
to false only from inside a GroupJunction

<p>
param intermediateResults if this parameter is provided, and we have to iterate, then iterate
over this result set instead of the entire base collection.
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledUndefined.java