Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -722,13 +722,18 @@ private static void doNestedIterationsForIndex(boolean continueRecursion, Select
} else if (currentLevel.getCmpIteratorDefn().getCollectionExpr()
.getType() == OQLLexerTokenTypes.LITERAL_select) {
useDerivedResults = false;
} else {
key = getCompiledIdFromPath(currentLevel.getCmpIteratorDefn().getCollectionExpr()).getId()
+ ':' + currentLevel.getDefinition();
}
SelectResults c;
if (useDerivedResults && derivedResults != null && derivedResults.containsKey(key)) {
c = derivedResults.get(key);
CompiledValue path = currentLevel.getCmpIteratorDefn().getCollectionExpr();
if (useDerivedResults && derivedResults != null && hasIdentifierAtLeafNode(path)) {
key = getCompiledIdFromPath(path).getId()
+ ':' + currentLevel.getDefinition();
if (derivedResults.containsKey(key)) {
c = derivedResults.get(key);
}
else {
c =currentLevel.evaluateCollection(context);
}
} else {
c = currentLevel.evaluateCollection(context);
}
Expand All @@ -751,6 +756,19 @@ private static void doNestedIterationsForIndex(boolean continueRecursion, Select
}
}

private static boolean hasIdentifierAtLeafNode(CompiledValue path) {
try {
if (path.getType() == OQLLexerTokenTypes.Identifier) {
return true;
} else {
return hasIdentifierAtLeafNode(path.getReceiver());
}
}catch (UnsupportedOperationException ex){
return false;
}

}

/**
* This function will evaluate the starting CompiledValue for a given CompliedValue. The value
* returned will always be either the original CompiledValue, or a CompiledID, or a
Expand Down