use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method testFindSourceNode2.
@Test
public void testFindSourceNode2() {
PlanNode root = getExamplePlan();
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(getGroup(3));
PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
assertEquals(NodeConstants.Types.SOURCE, originatingNode.getType());
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method testNonExistentSource.
@Test
public void testNonExistentSource() {
PlanNode root = getExamplePlan();
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(getGroup(4));
PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
assertNull(originatingNode);
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method getExamplePlan.
/**
* <pre>
* Join(groups=[3, 2, 1])
* Null(groups=[1])
* Select(groups=[2])
* Join(groups=[3, 2])
* Source(groups=[3])
* Access(groups=[2])
* </pre>
*/
public static PlanNode getExamplePlan() {
PlanNode joinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_CROSS);
joinNode.addGroup(getGroup(1));
joinNode.addGroup(getGroup(2));
joinNode.addGroup(getGroup(3));
PlanNode nullNode = NodeFactory.getNewNode(NodeConstants.Types.NULL);
nullNode.addGroup(getGroup(1));
joinNode.addFirstChild(nullNode);
PlanNode childCriteria = NodeFactory.getNewNode(NodeConstants.Types.SELECT);
childCriteria.setProperty(Info.SELECT_CRITERIA, new IsNullCriteria(new Constant(1)));
childCriteria.addGroup(getGroup(2));
joinNode.addLastChild(childCriteria);
PlanNode childJoinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
childJoinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_CROSS);
childJoinNode.addGroup(getGroup(2));
childJoinNode.addGroup(getGroup(3));
childCriteria.addFirstChild(childJoinNode);
PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
accessNode.addGroup(getGroup(2));
childJoinNode.addFirstChild(accessNode);
PlanNode sourceNode = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
sourceNode.addGroup(getGroup(3));
childJoinNode.addFirstChild(sourceNode);
return joinNode;
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method testFindJoinSourceNode1.
@Test
public void testFindJoinSourceNode1() {
PlanNode root = getExamplePlan();
PlanNode joinSource = FrameUtil.findJoinSourceNode(root.getLastChild());
assertEquals(NodeConstants.Types.JOIN, joinSource.getType());
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method testFindSourceNode.
@Test
public void testFindSourceNode() {
PlanNode root = getExamplePlan();
Set<GroupSymbol> groups = new HashSet<GroupSymbol>();
groups.add(getGroup(1));
PlanNode originatingNode = FrameUtil.findOriginatingNode(root, groups);
assertEquals(NodeConstants.Types.NULL, originatingNode.getType());
}
Aggregations