Class HyperGraph

java.lang.Object
org.apache.calcite.rel.AbstractRelNode
org.apache.calcite.rel.rules.HyperGraph
All Implemented Interfaces:
Cloneable, RelOptNode, RelNode

public class HyperGraph extends AbstractRelNode
HyperGraph represents a join graph.
  • Constructor Details

  • Method Details

    • copy

      public HyperGraph copy(RelTraitSet traitSet, List<RelNode> inputs)
      Description copied from interface: RelNode
      Creates a copy of this relational expression, perhaps changing traits and inputs.

      Sub-classes with other important attributes are encouraged to create variants of this method with more parameters.

      Specified by:
      copy in interface RelNode
      Overrides:
      copy in class AbstractRelNode
      Parameters:
      traitSet - Trait set
      inputs - Inputs
      Returns:
      Copy of this relational expression, substituting traits and inputs
    • explainTerms

      public RelWriter explainTerms(RelWriter pw)
      Description copied from class: AbstractRelNode
      Describes the inputs and attributes of this relational expression. Each node should call super.explainTerms, then call the RelWriter.input(String, RelNode) and RelWriter.item(String, Object) methods for each input and attribute.
      Overrides:
      explainTerms in class AbstractRelNode
      Parameters:
      pw - Plan writer
      Returns:
      Plan writer for fluent-explain pattern
    • getInputs

      public List<RelNode> getInputs()
      Description copied from interface: RelNode
      Returns an array of this relational expression's inputs. If there are no inputs, returns an empty list, not null.
      Specified by:
      getInputs in interface RelNode
      Specified by:
      getInputs in interface RelOptNode
      Overrides:
      getInputs in class AbstractRelNode
      Returns:
      Array of this relational expression's inputs
    • replaceInput

      public void replaceInput(int ordinalInParent, RelNode p)
      Description copied from interface: RelNode
      Replaces the ordinalInParentth input. You must override this method if you override RelNode.getInputs().
      Specified by:
      replaceInput in interface RelNode
      Overrides:
      replaceInput in class AbstractRelNode
      Parameters:
      ordinalInParent - Position of the child input, 0 is the first
      p - New node that should be put at position ordinalInParent
    • deriveRowType

      public RelDataType deriveRowType()
      Overrides:
      deriveRowType in class AbstractRelNode
    • accept

      public RelNode accept(RexShuttle shuttle)
      Description copied from interface: RelNode
      Accepts a visit from a shuttle. If the shuttle updates expression, then a copy of the relation should be created. This new relation might have a different row-type.
      Specified by:
      accept in interface RelNode
      Overrides:
      accept in class AbstractRelNode
      Parameters:
      shuttle - Shuttle
      Returns:
      A copy of this node incorporating changes made by the shuttle to this node's children
    • getEdges

      public List<HyperEdge> getEdges()
    • getNotProjectInputs

      public long getNotProjectInputs()
    • getNeighborBitmap

      public long getNeighborBitmap(long csg, long forbidden)
    • connectCsgCmp

      public List<HyperEdge> connectCsgCmp(long csg, long cmp)
      If csg and cmp are connected, return the edges that connect them.
    • initEdgeBitMap

      public void initEdgeBitMap(long subset)
    • updateEdgesForUnion

      public void updateEdgesForUnion(long subset1, long subset2)
    • extractJoinType

      public @Nullable JoinRelType extractJoinType(List<HyperEdge> edges)
    • applicable

      public boolean applicable(long csgcmp, List<HyperEdge> edges)
      Check whether the csg-cmp pair is applicable through the conflict rule.
      Parameters:
      csgcmp - csg-cmp pair
      edges - hyper edges with conflict rules
      Returns:
      true if the csg-cmp pair is applicable
    • extractJoinCond

      public RexNode extractJoinCond(List<HyperGraph.NodeState> inputOrder, int leftCount, List<HyperEdge> edges, JoinRelType joinType)
      Build an RexNode expression for the predicate corresponding to a set of hyperedges.
      Parameters:
      inputOrder - node status ordered list for current csg-cmp
      leftCount - number of tables in left child
      edges - hyper edges
      joinType - join type
      Returns:
      join condition
    • restoreProjectionOrder

      public List<RexNode> restoreProjectionOrder(List<HyperGraph.NodeState> resultOrder, List<RelDataTypeField> rowTypeList)
      Ensure that the fields produced by the reordered join are in the same order as in the original plan.
      Parameters:
      resultOrder - node status ordered list for the final result
      rowTypeList - rowType of the final result
      Returns:
      list of RexInputRef