Search in sources :

Example 11 with PlanNode

use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.

the class TestRuleAssignOutputElements method testFindNoAllUnion2.

@Test
public void testFindNoAllUnion2() {
    PlanNode unionNode = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
    unionNode.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
    unionNode.setProperty(NodeConstants.Info.USE_ALL, Boolean.TRUE);
    PlanNode projNode1 = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode projNode2 = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    unionNode.addLastChild(projNode1);
    projNode1.addLastChild(accessNode1);
    unionNode.addLastChild(projNode2);
    projNode2.addLastChild(accessNode2);
    helpTestIsUnionNoAll(unionNode, false);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) Test(org.junit.Test)

Example 12 with PlanNode

use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.

the class TestRuleAssignOutputElements method testFindNoAllUnion4.

@Test
public void testFindNoAllUnion4() {
    PlanNode unionNode1 = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
    unionNode1.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
    unionNode1.setProperty(NodeConstants.Info.USE_ALL, Boolean.TRUE);
    PlanNode unionNode2 = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
    unionNode2.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
    unionNode2.setProperty(NodeConstants.Info.USE_ALL, Boolean.FALSE);
    PlanNode projNode1 = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode projNode2 = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode projNode3 = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
    PlanNode accessNode3 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    unionNode1.addLastChild(projNode1);
    projNode1.addLastChild(accessNode1);
    unionNode1.addLastChild(unionNode2);
    unionNode2.addLastChild(projNode2);
    projNode2.addLastChild(accessNode2);
    unionNode2.addLastChild(projNode3);
    projNode3.addLastChild(accessNode3);
    helpTestIsUnionNoAll(unionNode1, true);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) Test(org.junit.Test)

Example 13 with PlanNode

use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.

the class TestRuleChooseDependent method testValidJoin3.

@Test
public void testValidJoin3() throws Exception {
    PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    accessNode1.addGroup(getPhysicalGroup(1));
    accessNode2.addGroup(getPhysicalGroup(2));
    PlanNode joinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
    joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_RIGHT_OUTER);
    List crits = new ArrayList();
    crits.add(new CompareCriteria(getElementSymbol(1, 1), CompareCriteria.EQ, getElementSymbol(2, 1)));
    joinNode.setProperty(NodeConstants.Info.JOIN_CRITERIA, crits);
    joinNode.addLastChild(accessNode1);
    joinNode.addLastChild(accessNode2);
    helpTestValidJoin(joinNode, accessNode1, true);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Test(org.junit.Test)

Example 14 with PlanNode

use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.

the class TestRuleChooseDependent method testValidJoin5.

@Test
public void testValidJoin5() throws Exception {
    PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode joinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
    joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_LEFT_OUTER);
    List crits = new ArrayList();
    crits.add(new CompareCriteria(getElementSymbol(1, 1), CompareCriteria.EQ, getElementSymbol(2, 1)));
    joinNode.setProperty(NodeConstants.Info.JOIN_CRITERIA, crits);
    joinNode.addLastChild(accessNode1);
    joinNode.addLastChild(accessNode2);
    helpTestValidJoin(joinNode, accessNode1, false);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Test(org.junit.Test)

Example 15 with PlanNode

use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.

the class TestRuleChooseDependent method testValidJoin6.

@Test
public void testValidJoin6() throws Exception {
    PlanNode accessNode1 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    PlanNode accessNode2 = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
    accessNode1.addGroup(getPhysicalGroup(1));
    accessNode2.addGroup(getPhysicalGroup(2));
    PlanNode joinNode = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
    joinNode.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_LEFT_OUTER);
    List crits = new ArrayList();
    crits.add(new CompareCriteria(getElementSymbol(1, 1), CompareCriteria.EQ, getElementSymbol(2, 1)));
    joinNode.setProperty(NodeConstants.Info.JOIN_CRITERIA, crits);
    joinNode.addLastChild(accessNode1);
    joinNode.addLastChild(accessNode2);
    helpTestValidJoin(joinNode, accessNode2, true);
}
Also used : PlanNode(org.teiid.query.optimizer.relational.plantree.PlanNode) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Test(org.junit.Test)

Aggregations

PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)204 Expression (org.teiid.query.sql.symbol.Expression)50 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)50 ArrayList (java.util.ArrayList)47 List (java.util.List)43 SymbolMap (org.teiid.query.sql.util.SymbolMap)42 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)36 Criteria (org.teiid.query.sql.lang.Criteria)35 LinkedList (java.util.LinkedList)24 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)24 Test (org.junit.Test)22 HashSet (java.util.HashSet)17 JoinType (org.teiid.query.sql.lang.JoinType)17 LinkedHashSet (java.util.LinkedHashSet)16 CompoundCriteria (org.teiid.query.sql.lang.CompoundCriteria)12 DependentSetCriteria (org.teiid.query.sql.lang.DependentSetCriteria)12 QueryPlannerException (org.teiid.api.exception.query.QueryPlannerException)11 LanguageObject (org.teiid.query.sql.LanguageObject)11 OrderBy (org.teiid.query.sql.lang.OrderBy)10 IsNullCriteria (org.teiid.query.sql.lang.IsNullCriteria)9