private CompiledValue getModifiedDependentCompiledValue(ExecutionContext context, int currItrID,
      CompiledValue cv, boolean isDependent)
      throws TypeMismatchException, NameResolutionException {

    if (cv instanceof CompiledIteratorDef) {
      CompiledIteratorDef iterDef = (CompiledIteratorDef) cv;
      RuntimeIterator rItr = (RuntimeIterator) context.getCurrentIterators().get(currItrID);
      String canonFrmClause = rItr.getDefinition();

      // TODO: original value of isDependent is always ignored
      isDependent = canonFrmClause.startsWith(canonicalizedIteratorNames[0]);

      return new CompiledIteratorDef(iterDef.getName(), rItr.getElementType(),
          getModifiedDependentCompiledValue(context, currItrID, iterDef.getCollectionExpr(),
              isDependent));

    } else if (cv instanceof CompiledPath) {
      CompiledPath path = (CompiledPath) cv;
      return new CompiledPath(
          getModifiedDependentCompiledValue(context, currItrID, path.getReceiver(), isDependent),
          path.getTailID());

    } else if (cv instanceof CompiledOperation) {
      CompiledOperation oper = (CompiledOperation) cv;
      List list = oper.getArguments();
      List newList = new ArrayList();
      for (Object aList : list) {
        CompiledValue cv1 = (CompiledValue) aList;
        StringBuilder sb = new StringBuilder();
        cv1.generateCanonicalizedExpression(sb, context);
        if (sb.toString().startsWith(canonicalizedIteratorNames[0])) {
          newList.add(getModifiedDependentCompiledValue(context, currItrID, cv1, true));
        } else {
          newList.add(getModifiedDependentCompiledValue(context, currItrID, cv1, false));
        }
      }

      // What if the receiver is null?
      CompiledValue rec = oper.getReceiver(context);
      if (rec == null) {
        if (isDependent) {
          rec = missingLink;
        }
        return new CompiledOperation(rec, oper.getMethodName(), newList);
      } else {
        return new CompiledOperation(
            getModifiedDependentCompiledValue(context, currItrID, rec, isDependent),
            oper.getMethodName(), newList);
      }

    } else if (cv instanceof CompiledFunction) {
      CompiledFunction cf = (CompiledFunction) cv;
      CompiledValue[] cvArray = cf.getArguments();
      int function = cf.getFunction();
      int len = cvArray.length;
      CompiledValue[] newCvArray = new CompiledValue[len];
      for (int i = 0; i < len; ++i) {
        CompiledValue cv1 = cvArray[i];
        StringBuilder sb = new StringBuilder();
        cv1.generateCanonicalizedExpression(sb, context);
        if (sb.toString().startsWith(canonicalizedIteratorNames[0])) {
          newCvArray[i] = getModifiedDependentCompiledValue(context, currItrID, cv1, true);
        } else {
          newCvArray[i] = getModifiedDependentCompiledValue(context, currItrID, cv1, false);
        }
      }
      return new CompiledFunction(newCvArray, function);

    } else if (cv instanceof CompiledID) {
      CompiledID id = (CompiledID) cv;
      RuntimeIterator rItr0 = (RuntimeIterator) context.getCurrentIterators().get(0);
      if (isDependent) {
        String name;
        if ((name = rItr0.getName()) != null && name.equals(id.getId())) {
          // The CompiledID is a RuneTimeIterator & so it needs to be replaced by the missing link
          return missingLink;
        } else {
          // The compiledID is a compiledPath
          return new CompiledPath(missingLink, id.getId());
        }
      } else {
        return cv;
      }

    } else if (cv instanceof CompiledIndexOperation) {
      CompiledIndexOperation co = (CompiledIndexOperation) cv;
      CompiledValue cv1 = co.getExpression();
      StringBuilder sb = new StringBuilder();
      cv1.generateCanonicalizedExpression(sb, context);
      if (sb.toString().startsWith(canonicalizedIteratorNames[0])) {
        cv1 = getModifiedDependentCompiledValue(context, currItrID, cv1, true);
      } else {
        cv1 = getModifiedDependentCompiledValue(context, currItrID, cv1, false);
      }
      return new CompiledIndexOperation(
          getModifiedDependentCompiledValue(context, currItrID, co.getReceiver(), isDependent),
          cv1);
    } else {
      return cv;
    }
  }
This function is used to correct the complied value's dependency , in case the compiledValue is
dependent on the 0th RuntimeIterator in some way. Thus the dependent compiled value is prefixed
with the missing link so that it is derivable from the 0th iterator.
geode-core/src/main/java/org/apache/geode/cache/query/internal/index/FunctionalIndexCreationHelper.java