use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testCountStarNoRows.
/**
* defect #4997
*/
@Test
public void testCountStarNoRows() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"select count(*) from vm1.u4", // $NON-NLS-1$
example1(), new String[] { // $NON-NLS-1$
"SELECT 1 FROM pm1.g2", // $NON-NLS-1$
"SELECT 1 FROM pm1.g1" });
checkNodeTypes(plan, new int[] { // Access
2, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
1, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
1 });
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testBadCollapseUnion.
// since this does not support convert, it should not be collapsed
@Test
public void testBadCollapseUnion() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
// $NON-NLS-1$
String sql = "select convert(e2+1,string) from pm1.g1 union all select e1 from pm1.g2";
// $NON-NLS-1$ //$NON-NLS-2$
String[] expectedSql = new String[] { "SELECT e2 FROM pm1.g1", "SELECT e1 FROM pm1.g2" };
ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.example1Cached(), null, capFinder, expectedSql, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] { // Access
2, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // Join
0, // MergeJoin
0, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
1 });
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testCase6597.
@Test
public void testCase6597() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_LIKE, true);
caps.setCapabilitySupport(Capability.CRITERIA_NOT, false);
// $NON-NLS-1$
capFinder.addCapabilities("BQT1", caps);
// Create query
// $NON-NLS-1$
String sql = "select IntKey from bqt1.smalla where stringkey not like '2%'";
ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, new String[] { "SELECT stringkey, IntKey FROM bqt1.smalla" }, // $NON-NLS-1$
TestOptimizer.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
1, // Sort
0, // UnionAll
0 });
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testCopyCriteriaWithTransitivePushdown2.
@Test
public void testCopyCriteriaWithTransitivePushdown2() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"select pm1.g1.e1, pm1.g2.e1 from pm1.g1, pm1.g4, pm1.g2, pm1.g3 where pm1.g1.e1 = pm1.g2.e1 and pm1.g2.e1 = pm1.g3.e1 and pm1.g1.e1 = 'a'", // $NON-NLS-1$
example1(), // $NON-NLS-1$
new String[] { "SELECT g_1.e1, g_2.e1 FROM pm1.g4 AS g_0, pm1.g1 AS g_1, pm1.g2 AS g_2, pm1.g3 AS g_3 WHERE (g_2.e1 = g_3.e1) AND (g_1.e1 = g_2.e1) AND (g_1.e1 = 'a') AND (g_2.e1 = 'a') AND (g_3.e1 = 'a')" });
checkNodeTypes(plan, FULL_PUSHDOWN);
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testPushDistinctVirtual4.
@Test
public void testPushDistinctVirtual4() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"select * from vm1.g13", // $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);
}
Aggregations