use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.
the class TestAggregatePushdown method testPushDownOverUnion.
@Test
public void testPushDownOverUnion() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = getAggregateCapabilities();
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
ProcessorPlan plan = // $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"select e1, max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) y group by e1", // $NON-NLS-1$
RealMetadataFactory.example1Cached(), // $NON-NLS-1$
null, // $NON-NLS-1$
capFinder, new String[] { "SELECT g_0.e1, MAX(g_0.e2) FROM pm1.g1 AS g_0 GROUP BY g_0.e1", "SELECT g_0.e1, MAX(g_0.e2) FROM pm1.g2 AS g_0 GROUP BY g_0.e1" }, // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.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.optimizer.capabilities.BasicSourceCapabilities in project teiid by teiid.
the class TestAggregatePushdown method testPushDownOverUnion1.
@Test
public void testPushDownOverUnion1() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = getAggregateCapabilities();
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
ProcessorPlan plan = // $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"select max(e2) from (select e1, e2 from pm1.g1 union all select e1, e2 from pm1.g2) z", // $NON-NLS-1$
RealMetadataFactory.example1Cached(), // $NON-NLS-1$
null, // $NON-NLS-1$
capFinder, new String[] { "SELECT MAX(g_0.e2) FROM pm1.g2 AS g_0", "SELECT MAX(g_0.e2) FROM pm1.g1 AS g_0" }, // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
TestOptimizer.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.optimizer.capabilities.BasicSourceCapabilities 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.BasicSourceCapabilities in project teiid by teiid.
the class TestConformedTables method testConformedSubquery.
@Test
public void testConformedSubquery() throws Exception {
String sql = "select pm2.g2.e1 from pm2.g2 where e1 in /*+ no_unnest */ (select e1 from pm1.g1)";
BasicSourceCapabilities bsc = getTypicalCapabilities();
bsc.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
helpPlan(sql, tm, new String[] { "SELECT g_0.e1 FROM pm2.g2 AS g_0 WHERE g_0.e1 IN /*+ NO_UNNEST */ (SELECT g_1.e1 FROM pm1.g1 AS g_1)" }, new DefaultCapabilitiesFinder(bsc), ComparisonMode.EXACT_COMMAND_STRING);
// TODO: it should work either way, but for now we expect the subquery to conform to the parent
sql = "select pm1.g1.e1 from pm1.g1 where e2 in (select e2 from pm2.g2)";
}
use of org.teiid.query.optimizer.capabilities.BasicSourceCapabilities 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