use of org.teiid.query.metadata.QueryMetadataInterface in project teiid by teiid.
the class TestAccessPatterns method testCase6425_4.
@Test
public void testCase6425_4() throws Exception {
// $NON-NLS-1$
String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR e2 = '2'";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
TestOptimizer.helpPlan(sql, metadata, null, TestOptimizer.ComparisonMode.FAILED_PLANNING);
}
use of org.teiid.query.metadata.QueryMetadataInterface in project teiid by teiid.
the class TestAccessPatterns method testMultiAccessPatternWithCriteria.
/*
* Criteria was preventing rule choose dependent from creating the appropriate dependent join
*/
@Test
public void testMultiAccessPatternWithCriteria() throws Exception {
// $NON-NLS-1$
String sql = "SELECT pm1.g1.* FROM pm4.g1, pm5.g1, pm1.g1 where pm4.g1.e1 = pm1.g1.e1 and pm5.g1.e1 = pm1.g1.e1 and pm5.g1.e2 like '%x' ";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
AnalysisRecord record = new AnalysisRecord(true, true);
TestOptimizer.helpPlanCommand(TestOptimizer.helpGetCommand(sql, metadata, null), metadata, TestOptimizer.getGenericFinder(false), record, new String[] { // $NON-NLS-1$
"SELECT g_0.e2, g_0.e1 FROM pm5.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)", // $NON-NLS-1$
"SELECT g_0.e1, g_0.e2, g_0.e3, g_0.e4 FROM pm1.g1 AS g_0", "SELECT g_0.e1 FROM pm4.g1 AS g_0 WHERE g_0.e1 IN (<dependent values>)" }, // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
assertTrue(record.getAnnotations().toString().contains("access pattern not satisfied by join"));
}
use of org.teiid.query.metadata.QueryMetadataInterface in project teiid by teiid.
the class TestAccessPatterns method testCase6425_2.
@Test
public void testCase6425_2() {
// $NON-NLS-1$
String sql = "SELECT e1 FROM pm4.g1 WHERE e1 = '1' OR (e1 = '2' AND e2 = 3)";
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
// $NON-NLS-1$
ProcessorPlan plan = TestOptimizer.helpPlan(sql, metadata, new String[] { "SELECT e1 FROM pm4.g1 WHERE (e1 = '1') OR ((e1 = '2') AND (e2 = 3))" });
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
use of org.teiid.query.metadata.QueryMetadataInterface in project teiid by teiid.
the class TestOptimizer method testSameConnector.
/**
* Normally the following queries would plan as if they were federated, but setting the connector_id source property
* allows them to be planned as if they were the same source.
*/
@Test
public void testSameConnector() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
caps.setCapabilitySupport(Capability.QUERY_UNION, true);
// $NON-NLS-1$
caps.setSourceProperty(Capability.CONNECTOR_ID, "1");
// $NON-NLS-1$
capFinder.addCapabilities("BQT1", caps);
// $NON-NLS-1$
capFinder.addCapabilities("BQT2", caps);
QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT A.IntKey, B.IntKey FROM BQT1.SmallA A LEFT OUTER JOIN BQT2.MediumB B ON A.IntKey = B.IntKey", metadata, null, capFinder, new String[] { // $NON-NLS-1$
"SELECT A.IntKey, B.IntKey FROM BQT1.SmallA AS A LEFT OUTER JOIN BQT2.MediumB AS B ON A.IntKey = B.IntKey" }, true);
checkNodeTypes(plan, FULL_PUSHDOWN);
plan = helpPlan(// $NON-NLS-1$
"SELECT A.IntKey FROM BQT1.SmallA A UNION select B.intkey from BQT2.MediumB B", metadata, null, capFinder, new String[] { // $NON-NLS-1$
"SELECT A.IntKey FROM BQT1.SmallA AS A UNION SELECT B.intkey FROM BQT2.MediumB AS B" }, true);
checkNodeTypes(plan, FULL_PUSHDOWN);
}
use of org.teiid.query.metadata.QueryMetadataInterface in project teiid by teiid.
the class TestOptimizer method testPushConvertClobToString.
@Test
public void testPushConvertClobToString() {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = new BasicSourceCapabilities();
caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
// $NON-NLS-1$
caps.setFunctionSupport("convert", true);
// $NON-NLS-1$
capFinder.addCapabilities("LOB", caps);
// Add join capability to pm1
QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
ProcessorPlan plan = helpPlan(// $NON-NLS-1$
"SELECT ClobValue from LOB.LobTbl WHERE convert(ClobValue, string) = ?", metadata, null, capFinder, // $NON-NLS-1$
new String[] { "SELECT LOB.LobTbl.ClobValue FROM LOB.LobTbl WHERE convert(LOB.LobTbl.ClobValue, string) = ?" }, SHOULD_SUCCEED);
checkNodeTypes(plan, FULL_PUSHDOWN);
}
Aggregations