Skip to content

Commit

Permalink
Prevent the IteratorBuildingVisitor from making unnecessary source de…
Browse files Browse the repository at this point in the history
…ep copies (#2686)

IteratorBuildingVisitor now tracks the number of source deep copies

Update TLD and Ancestor variants now delegate to source deep copy method
  • Loading branch information
apmoriarty authored Jan 15, 2025
1 parent dc0cf07 commit 9d85196
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ protected SortedKeyValueIterator<Key,Value> getSourceIterator(final ASTEQNode no
if (limitLookup && !negation) {
final String identifier = JexlASTHelper.getIdentifier(node);
if (!disableFiEval && fieldsToAggregate.contains(identifier)) {
final SortedKeyValueIterator<Key,Value> baseIterator = source.deepCopy(env);
final SortedKeyValueIterator<Key,Value> baseIterator = deepCopySource();
kvIter = new AncestorChildExpansionIterator(baseIterator, getMembers(), equality);
seekIndexOnlyDocument(kvIter, node);
} else {
kvIter = new IteratorToSortedKeyValueIterator(getNodeEntry(node).iterator());
}
} else {
kvIter = source.deepCopy(env);
kvIter = deepCopySource();
seekIndexOnlyDocument(kvIter, node);
}

Expand Down Expand Up @@ -105,7 +105,7 @@ private List<String> getMembers() {

// use the cached tree if available
if (members == null) {
SortedKeyValueIterator<Key,Value> kvIter = source.deepCopy(env);
SortedKeyValueIterator<Key,Value> kvIter = deepCopySource();
members = getMembers(wholeDocRange.getStartKey().getRow().toString(), tld, dataType, kvIter);

// set the members for later use
Expand All @@ -132,7 +132,7 @@ protected Collection<Map.Entry<Key,Value>> getNodeEntry(ASTEQNode node) {

// use the cached tree if available
if (members == null) {
SortedKeyValueIterator<Key,Value> kvIter = source.deepCopy(env);
SortedKeyValueIterator<Key,Value> kvIter = deepCopySource();
members = getMembers(wholeDocRange.getStartKey().getRow().toString(), tld, dataType, kvIter);

// set the members for later use
Expand Down
Loading

0 comments on commit 9d85196

Please sign in to comment.