rubenada commented on a change in pull request #1369: [CALCITE-2979] Add a 
block-based nested loop join algorithm (Khawla Mouhoubi)
URL: https://github.com/apache/calcite/pull/1369#discussion_r312553645
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumerableBatchNestedLoopJoinRule.java
 ##########
 @@ -0,0 +1,142 @@
+/*
+ * 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.adapter.enumerable;
+
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.core.CorrelationId;
+import org.apache.calcite.rel.core.Join;
+import org.apache.calcite.rel.core.JoinRelType;
+import org.apache.calcite.rel.logical.LogicalJoin;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexCorrelVariable;
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexShuttle;
+import org.apache.calcite.tools.RelBuilder;
+import org.apache.calcite.tools.RelBuilderFactory;
+import org.apache.calcite.util.ImmutableBitSet;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/** Planner rule that converts a
+ * {@link org.apache.calcite.rel.logical.LogicalJoin} into an
+ * {@link 
org.apache.calcite.adapter.enumerable.EnumerableBatchNestedLoopJoin}. */
+public class EnumerableBatchNestedLoopJoinRule extends RelOptRule {
+
+  private final int batchSize;
+  private static final int DEFAULT_BATCH_SIZE = 100;
+
+  /** Creates an EnumerableBatchNestedLoopJoinRule. */
+  protected EnumerableBatchNestedLoopJoinRule(Class<? extends Join> clazz,
+      RelBuilderFactory relBuilderFactory, int batchSize) {
+    super(operand(clazz, any()),
+        relBuilderFactory, "EnumerableBatchNestedLoopJoinRule");
+    this.batchSize = batchSize;
+  }
+  /** Creates an EnumerableBatchNestedLoopJoinRule with default batch size of 
100. */
+  public EnumerableBatchNestedLoopJoinRule(RelBuilderFactory 
relBuilderFactory) {
+    this(LogicalJoin.class, relBuilderFactory, DEFAULT_BATCH_SIZE);
+  }
+
+  /** Creates an EnumerableBatchNestedLoopJoinRule with given batch size.
+   * Warning: if the batch size is too big (>1000) there can be an error
 
 Review comment:
   `>`  breaks the javadoc, please use `&gt;`
   BTW, I think your tests showed problems already with 1000, so maybe the 
comment should be rephrased, e.g. ">500" or "around or bigger than 1000"

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

Reply via email to