rubenada commented on a change in pull request #1614: [CALCITE-3546] Improve EnumerableDefaults nested loop join URL: https://github.com/apache/calcite/pull/1614#discussion_r353038399
########## File path: linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java ########## @@ -1803,7 +1803,21 @@ private boolean innerHasNext() { final Predicate2<TSource, TInner> predicate, Function2<TSource, TInner, TResult> resultSelector, final JoinType joinType) { - // Building the result as a list is easy but hogs memory. We should iterate. + if (!joinType.generatesNullsOnLeft()) { + return nestedLoopJoinOptimized(outer, inner, predicate, resultSelector, joinType); + } + return nestedLoopJoinAsList(outer, inner, predicate, resultSelector, joinType); + } + + /** + * Implementation of nested loop join that builds the complete result as a list + * and then returns it. This is an easy-to-implement solution, but hogs memory. + */ + private static <TSource, TInner, TResult> Enumerable<TResult> nestedLoopJoinAsList( + final Enumerable<TSource> outer, final Enumerable<TInner> inner, + final Predicate2<TSource, TInner> predicate, + Function2<TSource, TInner, TResult> resultSelector, + final JoinType joinType) { Review comment: @julianhyde , you're right, I have created a separate ticket [1] to track that refactoring. [1] https://issues.apache.org/jira/browse/CALCITE-3555 ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services