private CompiledValue resolveAsVariable(String name) {
    CompiledValue value;
    for (int i = scopes.size() - 1; i >= 0; i--) {
      QScope scope = scopes.get(i);
      value = scope.resolve(name);
      if (value != null) {
        return value;
      }
    }
    return null;
  }
Return null if cannot be resolved as a variable in current scope
geode-core/src/main/java/org/apache/geode/cache/query/internal/ExecutionContext.java