use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestFrameUtil method testFindJoinSourceNode.
@Test
public void testFindJoinSourceNode() {
PlanNode root = getExamplePlan();
PlanNode joinSource = FrameUtil.findJoinSourceNode(root);
assertSame(root, joinSource);
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestJoinRegion method testFindJoinRegions.
public void testFindJoinRegions() {
List regions = new ArrayList();
PlanNode joinRoot = TestFrameUtil.getExamplePlan();
PlanNode joinRoot1 = TestFrameUtil.getExamplePlan();
PlanNode outerJoin = NodeFactory.getNewNode(NodeConstants.Types.JOIN);
outerJoin.setProperty(NodeConstants.Info.JOIN_TYPE, JoinType.JOIN_LEFT_OUTER);
outerJoin.addFirstChild(joinRoot);
outerJoin.addFirstChild(joinRoot1);
PlanNode source = NodeFactory.getNewNode(NodeConstants.Types.SOURCE);
source.addFirstChild(outerJoin);
RulePlanJoins.findJoinRegions(source, null, regions);
assertEquals(3, regions.size());
JoinRegion region = (JoinRegion) regions.get(0);
// ensure that the first region is the trivial region of the outer join
assertEquals(1, region.getJoinSourceNodes().size());
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestRuleAccessPatternValidation method helpPlan.
/**
* Parses and resolves the command, creates a canonical relational plan,
* and runs some of the optimizer rules, ending with the
* RuleChooseAccessPattern.
* @param command String command to parse, resolve and use for planning
* @param rules empty RuleStack
* @param groups Collection to add parsed and resolved GroupSymbols to
* @return the root PlanNode of the query plan
*/
private PlanNode helpPlan(String command) throws Exception {
Command query = QueryParser.getQueryParser().parseCommand(command);
QueryResolver.resolveCommand(query, METADATA);
// Generate canonical plan
RelationalPlanner p = new RelationalPlanner();
p.initialize(query, null, METADATA, FINDER, null, new CommandContext());
PlanNode planNode = p.generatePlan(query);
RelationalPlanner planner = new RelationalPlanner();
final RuleStack rules = planner.buildRules();
PlanNode testPlan = helpExecuteRules(rules, planNode, METADATA, DEBUG);
return testPlan;
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestRuleAssignOutputElements method testFindNoAllUnion1.
@Test
public void testFindNoAllUnion1() {
PlanNode projNode = NodeFactory.getNewNode(NodeConstants.Types.PROJECT);
PlanNode accessNode = NodeFactory.getNewNode(NodeConstants.Types.ACCESS);
projNode.addLastChild(accessNode);
helpTestIsUnionNoAll(projNode, false);
}
use of org.teiid.query.optimizer.relational.plantree.PlanNode in project teiid by teiid.
the class TestRuleAssignOutputElements method testFindNoAllUnion3.
@Test
public void testFindNoAllUnion3() {
PlanNode unionNode = NodeFactory.getNewNode(NodeConstants.Types.SET_OP);
unionNode.setProperty(NodeConstants.Info.SET_OPERATION, Operation.UNION);
unionNode.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);
unionNode.addLastChild(projNode1);
projNode1.addLastChild(accessNode1);
unionNode.addLastChild(projNode2);
projNode2.addLastChild(accessNode2);
helpTestIsUnionNoAll(unionNode, true);
}
Aggregations