use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.
the class TestBatchedUpdatePlanner method testPlannerNoCommandsBatched.
public void testPlannerNoCommandsBatched() throws Exception {
String[] sql = { // $NON-NLS-1$
"INSERT INTO pm1.g1 (e1, e2, e3, e4) values ('string1', 1, {b'true'}, 1.0)", // $NON-NLS-1$
"INSERT INTO pm1.g2 (e1, e2, e3, e4) values ('string1', 1, {b'true'}, 1.0)", // $NON-NLS-1$
"DELETE FROM pm1.g1 WHERE e2 > 5000", // $NON-NLS-1$
"UPDATE pm1.g1 set e2 = -1 WHERE e2 = 4999" };
FakeCapabilitiesFinder finder = new FakeCapabilitiesFinder();
// $NON-NLS-1$
finder.addCapabilities("pm1", new FakeCapabilities(false));
boolean[] expectedBatching = { false, false, false, false };
helpTestPlanner(sql, expectedBatching, finder);
}
use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.
the class TestComparableMetadataPushdown method testCantPushDup.
@Test
public void testCantPushDup() throws Exception {
// $NON-NLS-1$
String sql = "select distinct e3, e2 from test.group";
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
// $NON-NLS-1$
capFinder.addCapabilities("test", TestOptimizer.getTypicalCapabilities());
TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata(), new String[] { "SELECT g_0.e3, g_0.e2 FROM test.\"group\" AS g_0" }, capFinder, // $NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.
the class TestComparableMetadataPushdown method testCantPushSetOp.
@Test
public void testCantPushSetOp() throws Exception {
// $NON-NLS-1$
String sql = "select e3, e2 from test.group union select e0, e1 from test.group2";
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
// $NON-NLS-1$
capFinder.addCapabilities("test", caps);
TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata(), new String[] { "SELECT test.\"group\".e3, test.\"group\".e2 FROM test.\"group\"", "SELECT test.group2.e0, test.group2.e1 FROM test.group2" }, capFinder, // $NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.
the class TestComparableMetadataPushdown method testCantPushSort.
@Test
public void testCantPushSort() throws Exception {
// $NON-NLS-1$
String sql = "select e3, e2 from test.group order by e3, e2";
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
// $NON-NLS-1$
capFinder.addCapabilities("test", TestOptimizer.getTypicalCapabilities());
TestOptimizer.helpPlan(sql, TestValidator.exampleMetadata(), new String[] { "SELECT g_0.e3, g_0.e2 FROM test.\"group\" AS g_0" }, capFinder, // $NON-NLS-1$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.
the class TestDependentJoins method testOptionMakeDep2.
@Test
public void testOptionMakeDep2() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, false);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
// $NON-NLS-1$
capFinder.addCapabilities("pm2", caps);
ProcessorPlan plan = // $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"select pm1.g1.e1, pm2.g1.e1 from pm1.g1 MAKEDEP INNER JOIN pm2.g1 MAKENOTDEP ON pm1.g1.e1 = pm2.g1.e1", // $NON-NLS-1$
RealMetadataFactory.example1Cached(), // $NON-NLS-1$
null, // $NON-NLS-1$
capFinder, new String[] { "SELECT g_0.e1 FROM pm1.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", "SELECT g_0.e1 FROM pm2.g1 AS g_0" }, // $NON-NLS-1$ //$NON-NLS-2$
TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING);
// $NON-NLS-1$
checkDependentGroups(plan, new String[] { "pm1.g1" });
// $NON-NLS-1$
checkNotDependentGroups(plan, new String[] { "pm2.g1" });
TestOptimizer.checkNodeTypes(plan, new int[] { // Access
1, // DependentAccess
1, // 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