rubenada commented on code in PR #4204:
URL: https://github.com/apache/calcite/pull/4204#discussion_r1979280738


##########
core/src/main/java/org/apache/calcite/rel/rules/HyperGraph.java:
##########
@@ -0,0 +1,459 @@
+/*
+ * 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.rel.rules;
+
+import org.apache.calcite.linq4j.Ord;
+import org.apache.calcite.plan.RelOptCluster;
+import org.apache.calcite.plan.RelTraitSet;
+import org.apache.calcite.rel.AbstractRelNode;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelWriter;
+import org.apache.calcite.rel.core.JoinRelType;
+import org.apache.calcite.rel.logical.LogicalProject;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeField;
+import org.apache.calcite.rex.RexBiVisitor;
+import org.apache.calcite.rex.RexInputRef;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexShuttle;
+import org.apache.calcite.rex.RexUtil;
+import org.apache.calcite.rex.RexVariable;
+import org.apache.calcite.rex.RexVisitor;
+
+import com.google.common.collect.ImmutableList;
+
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static com.google.common.base.Preconditions.checkArgument;
+
+/**
+ * HyperGraph represents a join graph.
+ */
+public class HyperGraph extends AbstractRelNode {
+
+  private final List<RelNode> inputs;
+
+  @SuppressWarnings("HidingField")
+  private final RelDataType rowType;
+
+  private final List<HyperEdge> edges;
+
+  // record the indices of complex hyper edges in the 'edges'
+  private final BitSet complexEdgesBitmap;
+
+  /**
+   * For the HashMap fields, key is the bitmap for inputs,
+   * value is the hyper edge bitmap in edges.
+   */
+  // record which hyper edges have been used by the enumerated csg-cmp pairs
+  private final HashMap<Long, BitSet> ccpUsedEdgesMap;
+
+  private final HashMap<Long, BitSet> simpleEdgesMap;
+
+  private final HashMap<Long, BitSet> complexEdgesMap;
+
+  // node bitmap overlaps edge's leftNodeBits or rightNodeBits, but does not 
completely cover
+  private final HashMap<Long, BitSet> overlapEdgesMap;
+
+  protected HyperGraph(RelOptCluster cluster,
+      RelTraitSet traitSet,
+      List<RelNode> inputs,
+      List<HyperEdge> edges,
+      RelDataType rowType) {
+    super(cluster, traitSet);
+    this.inputs = inputs;

Review Comment:
   Probably it'll be wise to make a defensive copy of the lists of inputs and 
edges, just in case.



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