use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testManyJoinsGreedy.
@Test
public void testManyJoinsGreedy() throws Exception {
TransformationMetadata tm = example1();
RealMetadataFactory.setCardinality("pm1.g5", 1000000, tm);
RealMetadataFactory.setCardinality("pm1.g4", 1000000, tm);
RealMetadataFactory.setCardinality("pm1.g1", 10000000, tm);
RealMetadataFactory.setCardinality("pm1.g8", 100, tm);
RealMetadataFactory.setCardinality("pm1.g3", 10000, tm);
RealMetadataFactory.setCardinality("pm1.g6", 100000, tm);
ProcessorPlan plan = helpPlan("SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2, pm1.g3, pm1.g4, pm1.g5, pm1.g6, pm1.g7, pm1.g8 " + // $NON-NLS-1$
"WHERE pm1.g1.e1 = pm1.g2.e1 AND pm1.g2.e1 = pm1.g3.e1 AND pm1.g3.e1 = pm1.g4.e1 AND pm1.g4.e1 = pm1.g5.e1 AND pm1.g5.e1=pm1.g6.e1 AND pm1.g6.e1=pm1.g7.e1 AND pm1.g7.e1=pm1.g8.e1", tm, new String[] { // $NON-NLS-1$
"SELECT pm1.g1.e1 FROM pm1.g1", // $NON-NLS-1$
"SELECT pm1.g2.e1 FROM pm1.g2", // $NON-NLS-1$
"SELECT pm1.g3.e1 FROM pm1.g3", // $NON-NLS-1$
"SELECT pm1.g4.e1 FROM pm1.g4", // $NON-NLS-1$
"SELECT pm1.g5.e1 FROM pm1.g5", // $NON-NLS-1$
"SELECT pm1.g6.e1 FROM pm1.g6", // $NON-NLS-1$
"SELECT pm1.g7.e1 FROM pm1.g7", // $NON-NLS-1$
"SELECT pm1.g8.e1 FROM pm1.g8" }, new DefaultCapabilitiesFinder(), // $NON-NLS-1$
ComparisonMode.CORRECTED_COMMAND_STRING);
RelationalPlan rp = (RelationalPlan) plan;
// g1 should be last
assertEquals("[pm1.g1.e1]", ((JoinNode) rp.getRootNode().getChildren()[0]).getRightExpressions().toString());
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testPushDistinctVirtual1.
@Test
public void testPushDistinctVirtual1() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"select * from vm1.g12", // $NON-NLS-1$
RealMetadataFactory.example1Cached(), // $NON-NLS-1$
new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1" });
checkNodeTypes(plan, FULL_PUSHDOWN);
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testPushGroupBy4.
@Test
public void testPushGroupBy4() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_MAX, true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT x+2 AS y FROM (SELECT e1, max(e2) as x FROM pm1.g1 GROUP BY e1) AS z", RealMetadataFactory.example1Cached(), null, capFinder, // $NON-NLS-1$
new String[] { "SELECT MAX(e2) FROM pm1.g1 GROUP BY e1" }, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] { // Access
1, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
0 });
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testFunctionSimplification1.
/**
* Tests outer join defect #7945
*/
@Test
public void testFunctionSimplification1() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT x FROM vm1.g18 WHERE x = 92.0", RealMetadataFactory.example1Cached(), new String[] { // $NON-NLS-1$
"SELECT e4 FROM pm1.g1 WHERE e4 = 0.92" });
checkNodeTypes(plan, new int[] { // Access
1, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
0 });
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testUnionPushdownMultipleBranchesMixedModels1.
@Test
public void testUnionPushdownMultipleBranchesMixedModels1() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, false);
// $NON-NLS-1$
capFinder.addCapabilities("BQT1", caps);
// $NON-NLS-1$
capFinder.addCapabilities("BQT2", caps);
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB UNION ALL SELECT IntKey FROM BQT2.SmallA", // $NON-NLS-1$
RealMetadataFactory.exampleBQTCached(), null, capFinder, // $NON-NLS-1$ //$NON-NLS-2$
new String[] { "SELECT IntKey FROM BQT1.SmallA UNION ALL SELECT IntKey FROM BQT1.SmallB", "SELECT IntKey FROM BQT2.SmallA" }, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] { // Access
2, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
0, // Select
0, // Sort
0, // UnionAll
1 });
}
Aggregations