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_r352588517
##########
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:
I understand your point, and I'm not against it; but I'd rather keep the
join algorithms as "complete" as possible. I don't think leaving this method
here as it is will be confusing. Let's see what the rest of the community think
about this topic.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services