Skip to content

Commit

Permalink
[CALCITE-6251] InnerEnumerator in EnumerableDefaults::correlateBatchJ…
Browse files Browse the repository at this point in the history
…oin is not closed
  • Loading branch information
kramerul committed Feb 7, 2024
1 parent 4b05e05 commit b22e32c
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1717,6 +1717,8 @@ public static <TSource, TInner, TResult> Enumerable<TResult> correlateBatchJoin(
if (innerEnumerable == null) {
innerEnumerable = Linq4j.emptyEnumerable();
}
closeInner();
Enumerable<TInner> innerEnumerable = requireNonNull(this.innerEnumerable);
innerEnumerator = innerEnumerable.enumerator();
innerEnumHasNext = innerEnumerator.moveNext();

Expand Down Expand Up @@ -1799,11 +1801,16 @@ private boolean innerHasNext() {
i = -1;
}

@Override public void close() {
outerEnumerator.close();
private void closeInner() {
if (innerEnumerator != null) {
innerEnumerator.close();
innerEnumerator = null;
}
}

@Override public void close() {
outerEnumerator.close();
closeInner();
outerValue = null;
innerValue = null;
}
Expand Down

0 comments on commit b22e32c

Please sign in to comment.