protected ObjectType prepareResultType(ExecutionContext context)
      throws TypeMismatchException, AmbiguousNameException {
    // if no projection attributes or '*'as projection attribute
    // & more than one/RunTimeIterator then create a StrcutSet.
    // If attribute is null or '*' & only one RuntimeIterator then create a
    // ResultSet.
    // If single attribute is present without alias name , then create
    // ResultSet
    // Else if more than on attribute or single attribute with alias is
    // present then return a StrcutSet
    // create StructSet which will contain root objects of all iterators in
    // from clause

    ObjectType elementType = null;
    SelectResults sr = null;

    List currentIterators = context.getCurrentIterators();
    if (projAttrs == null) {
      if (currentIterators.size() == 1) {
        RuntimeIterator iter = (RuntimeIterator) currentIterators.get(0);
        elementType = iter.getElementType();
      } else {
        elementType = createStructTypeForNullProjection(currentIterators, context);
      }
    } else {
      // Create StructType for projection attributes
      int projCount = projAttrs.size();
      String[] fieldNames = new String[projCount];
      ObjectType[] fieldTypes = new ObjectType[projCount];
      boolean createStructSet = false;
      String fldName = null;
      for (int i = 0; i < projCount; i++) {
        Object[] projDef = (Object[]) projAttrs.get(i);
        fldName = (String) projDef[0];
        if (!createStructSet) {
          if (fldName != null || projCount > 1) {
            createStructSet = true;
          }
        }
        fieldNames[i] = (fldName == null && createStructSet)
            ? generateProjectionName((CompiledValue) projDef[1], context) : fldName;
        fieldTypes[i] = getFieldTypeOfProjAttrib(context, (CompiledValue) projDef[1]);
        // fieldTypes[i] = TypeUtils.OBJECT_TYPE;
      }
      if (createStructSet) {
        elementType = new StructTypeImpl(fieldNames, fieldTypes);
      } else {
        elementType = fieldTypes[0];
      }
    }
    return elementType;
  }
Check for the bulk-get pattern and if it applies do an optimized execution. The pattern is:
SELECT ?? FROM <Region>.entrySet e WHERE e.key IN <Collection>.

@return a List of entries if optimization was executed, or null if it wasn't because the
        optimization pattern didn't match
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledSelect.java