Package org.apache.calcite.rel.rules
Class LoptJoinTree
- java.lang.Object
-
- org.apache.calcite.rel.rules.LoptJoinTree
-
public class LoptJoinTree extends java.lang.Object
Utility class used to store aJoin
tree and the factors that make up the tree.Because
RelNode
s can be duplicated in a query when you have a self-join, factor ids are needed to distinguish between the different join inputs that correspond to identical tables. The class associates factor ids with a join tree, matching the order of the factor ids with the order of those factors in the join tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
LoptJoinTree.BinaryTree
Simple binary tree class that stores an id in the leaf nodes and keeps track of the parent LoptJoinTree object associated with the binary tree.protected static class
LoptJoinTree.Leaf
Binary tree node that has no children.protected static class
LoptJoinTree.Node
Binary tree node that has two children.
-
Field Summary
Fields Modifier and Type Field Description private LoptJoinTree.BinaryTree
factorTree
private RelNode
joinTree
private boolean
removableSelfJoin
-
Constructor Summary
Constructors Constructor Description LoptJoinTree(RelNode joinTree, int factorId)
Creates a join-tree consisting of a single node.LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree factorTree, boolean removableSelfJoin)
Associates the factor ids with a join-tree.LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree leftFactorTree, LoptJoinTree.BinaryTree rightFactorTree)
Associates the factor ids with a join-tree given the factors corresponding to the left and right subtrees of the join.LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree leftFactorTree, LoptJoinTree.BinaryTree rightFactorTree, boolean removableSelfJoin)
Associates the factor ids with a join-tree given the factors corresponding to the left and right subtrees of the join.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoptJoinTree.BinaryTree
getFactorTree()
RelNode
getJoinTree()
LoptJoinTree
getLeft()
LoptJoinTree
getRight()
java.util.List<java.lang.Integer>
getTreeOrder()
void
getTreeOrder(java.util.List<java.lang.Integer> treeOrder)
boolean
isRemovableSelfJoin()
-
-
-
Field Detail
-
factorTree
private final LoptJoinTree.BinaryTree factorTree
-
joinTree
private final RelNode joinTree
-
removableSelfJoin
private final boolean removableSelfJoin
-
-
Constructor Detail
-
LoptJoinTree
public LoptJoinTree(RelNode joinTree, int factorId)
Creates a join-tree consisting of a single node.- Parameters:
joinTree
- RelNode corresponding to the single nodefactorId
- factor id of the node
-
LoptJoinTree
public LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree factorTree, boolean removableSelfJoin)
Associates the factor ids with a join-tree.- Parameters:
joinTree
- RelNodes corresponding to the join treefactorTree
- tree of the factor idsremovableSelfJoin
- whether the join corresponds to a removable self-join
-
LoptJoinTree
public LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree leftFactorTree, LoptJoinTree.BinaryTree rightFactorTree)
Associates the factor ids with a join-tree given the factors corresponding to the left and right subtrees of the join.- Parameters:
joinTree
- RelNodes corresponding to the join treeleftFactorTree
- tree of the factor ids for left subtreerightFactorTree
- tree of the factor ids for the right subtree
-
LoptJoinTree
public LoptJoinTree(RelNode joinTree, LoptJoinTree.BinaryTree leftFactorTree, LoptJoinTree.BinaryTree rightFactorTree, boolean removableSelfJoin)
Associates the factor ids with a join-tree given the factors corresponding to the left and right subtrees of the join. Also indicates whether the join is a removable self-join.- Parameters:
joinTree
- RelNodes corresponding to the join treeleftFactorTree
- tree of the factor ids for left subtreerightFactorTree
- tree of the factor ids for the right subtreeremovableSelfJoin
- true if the join is a removable self-join
-
-
Method Detail
-
getJoinTree
public RelNode getJoinTree()
-
getLeft
public LoptJoinTree getLeft()
-
getRight
public LoptJoinTree getRight()
-
getFactorTree
public LoptJoinTree.BinaryTree getFactorTree()
-
getTreeOrder
public java.util.List<java.lang.Integer> getTreeOrder()
-
getTreeOrder
public void getTreeOrder(java.util.List<java.lang.Integer> treeOrder)
-
isRemovableSelfJoin
public boolean isRemovableSelfJoin()
-
-