rubenada commented on a change in pull request #1156: [CALCITE-2973] Allow
theta joins that have equi conditions to be exec…
URL: https://github.com/apache/calcite/pull/1156#discussion_r316719387
##########
File path:
linq4j/src/main/java/org/apache/calcite/linq4j/EnumerableDefaults.java
##########
@@ -1065,20 +1089,30 @@ public void close() {
final Function1<TInner, TKey> innerKeySelector,
final Function2<TSource, TInner, TResult> resultSelector,
final EqualityComparer<TKey> comparer, final boolean generateNullsOnLeft,
- final boolean generateNullsOnRight) {
+ final boolean generateNullsOnRight, final Predicate2<TSource, TInner>
predicate) {
return new AbstractEnumerable<TResult>() {
public Enumerator<TResult> enumerator() {
+ /**
+ * the innerToLookUp will refer the inner , if current join
+ * is a right join, we should figure out the right list first, if
+ * not, then keep the original inner here.
+ */
+ final Enumerable<TInner> innerToLookUp = generateNullsOnLeft
+ ? Linq4j.asEnumerable(inner.toList())
+ : inner;
+
final Lookup<TKey, TInner> innerLookup =
comparer == null
- ? inner.toLookup(innerKeySelector)
- : inner.toLookup(innerKeySelector, comparer);
+ ? innerToLookUp.toLookup(innerKeySelector)
+ : innerToLookUp
+ .toLookup(innerKeySelector, comparer);
return new Enumerator<TResult>() {
Enumerator<TSource> outers = outer.enumerator();
Enumerator<TInner> inners = Linq4j.emptyEnumerator();
- Set<TKey> unmatchedKeys =
+ List<TInner> innersUnmatched =
Review comment:
I left a comment in the Jira ticket regarding this particular change. Since
it is a more general topic, we can discuss there.
----------------------------------------------------------------
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