use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testUnionPushdownWithFunctionsAndAliases.
@Test
public void testUnionPushdownWithFunctionsAndAliases() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
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$
caps.setFunctionSupport("+", true);
// $NON-NLS-1$
capFinder.addCapabilities("BQT1", caps);
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT IntKey+2, StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB", // $NON-NLS-1$
RealMetadataFactory.exampleBQTCached(), null, capFinder, // $NON-NLS-1$
new String[] { "SELECT (IntKey + 2), StringKey AS x FROM BQT1.SmallA UNION SELECT IntKey, StringKey FROM BQT1.SmallB" }, SHOULD_SUCCEED);
checkNodeTypes(plan, FULL_PUSHDOWN);
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testCantPushCaseInSelectWithFunction.
@Test
public void testCantPushCaseInSelectWithFunction() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_CASE, true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT CASE e1 WHEN 'a' THEN 10 ELSE (e2+0) END FROM pm1.g1", metadata, null, capFinder, // $NON-NLS-1$
new String[] { "SELECT e1, e2 FROM pm1.g1" }, 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 testSubquery1.
@Test
public void testSubquery1() {
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"Select e1 from (select e1 FROM pm1.g1) AS x", // $NON-NLS-1$
example1(), // $NON-NLS-1$
new String[] { "SELECT e1 FROM pm1.g1" });
checkNodeTypes(plan, FULL_PUSHDOWN);
}
use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.
the class TestOptimizer method testUseMergeJoin5_CostsNotKnown.
/**
* Should use merge join, since costs are not known, neither access node is "strong"
*/
@Test
public void testUseMergeJoin5_CostsNotKnown() {
// Create query
// $NON-NLS-1$
String sql = "SELECT pm1.g1.e1 FROM pm1.g1, pm1.g2 WHERE pm1.g1.e1 = pm1.g2.e1";
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
ProcessorPlan plan = helpPlan(sql, metadata, null, capFinder, new String[] { "SELECT pm1.g1.e1 FROM pm1.g1", "SELECT pm1.g2.e1 FROM pm1.g2" }, // $NON-NLS-1$ //$NON-NLS-2$
SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] { // Access
2, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
1, // 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 testCase2589w.
/**
* Same as previous testCase2589v, but with full outer join.
*/
@Test
public void testCase2589w() {
String sql = // $NON-NLS-1$
"SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA FULL OUTER JOIN " + // $NON-NLS-1$
"VQT.SmallA_2589 ON MediumA.IntKey = SmallA_2589.IntKey";
String[] expected = new String[] { // $NON-NLS-1$
"SELECT BQT1.MediumA.IntKey FROM BQT1.MediumA", // $NON-NLS-1$
"SELECT BQT1.SmallA.IntKey FROM BQT1.SmallA WHERE StringNum = '10'" };
// Plan query
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, false);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, false);
// $NON-NLS-1$
caps.setFunctionSupport("concat", true);
// $NON-NLS-1$
capFinder.addCapabilities("BQT1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(sql, metadata, null, capFinder, expected, SHOULD_SUCCEED);
checkNodeTypes(plan, new int[] { // Access
2, // DependentAccess
0, // DependentSelect
0, // DependentProject
0, // DupRemove
0, // Grouping
0, // NestedLoopJoinStrategy
0, // MergeJoinStrategy
1, // Null
0, // PlanExecution
0, // Project
1, // Select
0, // Sort
0, // UnionAll
0 });
}
Aggregations