zzwqqq commented on code in PR #5233:
URL: https://github.com/apache/calcite/pull/5233#discussion_r3943720793


##########
linq4j/src/main/java/org/apache/calcite/linq4j/IEJoinEnumerator.java:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.linq4j;
+
+import org.apache.calcite.linq4j.function.Function1;
+import org.apache.calcite.linq4j.function.Function2;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Comparator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import static org.apache.calcite.linq4j.Nullness.castNonNull;
+
+/** Enumerator that implements IEJoin for two inequality predicates.
+ *
+ * <p>Implements the union-array algorithm described by Khayyat et al. in
+ * <a href="https://doi.org/10.14778/2831360.2831362";>"Lightning Fast and Space
+ * Efficient Inequality Joins," PVLDB 8(13), 2015</a>.
+ *
+ * <p>In Section 4.2, {@code firstOrder}, temporary {@code secondOrder},
+ * {@code permutation}, and {@code activeRights} correspond to merged
+ * {@code L1/L1'}, merged {@code L2/L2'}, merged {@code P/P'}, and extended
+ * {@code B'}, respectively. {@code Entry.isLeft} records the source input.
+ *
+ * @param <TLeft> Left row type
+ * @param <TRight> Right row type
+ * @param <TKey1> First key type
+ * @param <TKey2> Second key type
+ * @param <TResult> Result row type
+ */
+final class IEJoinEnumerator<TLeft, TRight, TKey1, TKey2, TResult>
+    implements Enumerator<TResult> {
+  private final List<TLeft> leftRows = new ArrayList<>();
+  private final List<TRight> rightRows = new ArrayList<>();
+  private final List<Entry<TKey1, TKey2>> firstOrder;

Review Comment:
   > some of these fields are not obvious, can you please document them?
   Thanks, I've added comments for these fields.
   
   



##########
linq4j/src/main/java/org/apache/calcite/linq4j/IEJoinEnumerator.java:
##########
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.linq4j;
+
+import org.apache.calcite.linq4j.function.Function1;
+import org.apache.calcite.linq4j.function.Function2;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.Comparator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import static org.apache.calcite.linq4j.Nullness.castNonNull;
+
+/** Enumerator that implements IEJoin for two inequality predicates.
+ *
+ * <p>Implements the union-array algorithm described by Khayyat et al. in
+ * <a href="https://doi.org/10.14778/2831360.2831362";>"Lightning Fast and Space
+ * Efficient Inequality Joins," PVLDB 8(13), 2015</a>.
+ *
+ * <p>In Section 4.2, {@code firstOrder}, temporary {@code secondOrder},
+ * {@code permutation}, and {@code activeRights} correspond to merged
+ * {@code L1/L1'}, merged {@code L2/L2'}, merged {@code P/P'}, and extended
+ * {@code B'}, respectively. {@code Entry.isLeft} records the source input.
+ *
+ * @param <TLeft> Left row type
+ * @param <TRight> Right row type
+ * @param <TKey1> First key type
+ * @param <TKey2> Second key type
+ * @param <TResult> Result row type
+ */
+final class IEJoinEnumerator<TLeft, TRight, TKey1, TKey2, TResult>
+    implements Enumerator<TResult> {
+  private final List<TLeft> leftRows = new ArrayList<>();
+  private final List<TRight> rightRows = new ArrayList<>();
+  private final List<Entry<TKey1, TKey2>> firstOrder;

Review Comment:
   > some of these fields are not obvious, can you please document them?
   
   Thanks, I've added comments for these fields.
   
   



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to