use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.
the class TestJoinOptimization method testEvaluatableSubqueryInOn1.
/**
* @throws TeiidComponentException
* @throws TeiidProcessingException
*/
@Test
public void testEvaluatableSubqueryInOn1() throws TeiidComponentException, TeiidProcessingException {
// $NON-NLS-1$
String sql = "select b1.intkey, b2.intkey from bqt1.smalla b1 left outer join bqt1.smallb b2 on (b1.intkey = b2.intkey and b2.stringkey in (select stringkey from bqt1.mediuma))";
BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
bsc.setCapabilitySupport(Capability.QUERY_FROM_INLINE_VIEWS, true);
bsc.setCapabilitySupport(Capability.CRITERIA_ON_SUBQUERY, false);
bsc.setCapabilitySupport(Capability.CRITERIA_IN_SUBQUERY, true);
ProcessorPlan plan = TestOptimizer.helpPlan(sql, RealMetadataFactory.exampleBQTCached(), new String[] { "SELECT g_0.IntKey AS c_0 FROM BQT1.SmallA AS g_0 ORDER BY c_0", "SELECT g_0.IntKey AS c_0 FROM BQT1.SmallB AS g_0 WHERE g_0.StringKey IN (SELECT g_1.StringKey FROM BQT1.MediumA AS g_1) ORDER BY c_0" }, new DefaultCapabilitiesFinder(bsc), // $NON-NLS-1$ //$NON-NLS-2$
ComparisonMode.EXACT_COMMAND_STRING);
HardcodedDataManager hdm = new HardcodedDataManager();
hdm.addData("SELECT g_0.IntKey AS c_0 FROM BQT1.SmallA AS g_0 ORDER BY c_0", Arrays.asList(1));
hdm.addData("SELECT g_0.IntKey AS c_0 FROM BQT1.SmallB AS g_0 WHERE g_0.StringKey IN (SELECT g_1.StringKey FROM BQT1.MediumA AS g_1) ORDER BY c_0", Arrays.asList(1));
TestProcessor.helpProcess(plan, hdm, new List<?>[] { Arrays.asList(1, 1) });
}
use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.
the class TestJoinOptimization method testLeftOuterAssocitivtyRightLinear.
@Test
public void testLeftOuterAssocitivtyRightLinear() throws Exception {
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
// $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"SELECT pm1.g1.e3 from pm1.g1 left outer join (pm1.g2 left outer join pm2.g3 on pm1.g2.e2 = pm2.g3.e2) on pm1.g1.e1 = pm1.g2.e1", RealMetadataFactory.example1Cached(), new String[] { "SELECT g_1.e2 AS c_0, g_0.e3 AS c_1 FROM pm1.g1 AS g_0 LEFT OUTER JOIN pm1.g2 AS g_1 ON g_0.e1 = g_1.e1 ORDER BY c_0", "SELECT g_0.e2 AS c_0 FROM pm2.g3 AS g_0 ORDER BY c_0" }, new DefaultCapabilitiesFinder(caps), // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.
the class TestJoinOptimization method testLeftOuterAssocitivtyLeftLinear.
@Test
public void testLeftOuterAssocitivtyLeftLinear() throws Exception {
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
// $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"SELECT pm1.g1.e3 from pm1.g1 left outer join pm2.g2 on pm1.g1.e1 = pm2.g2.e1 left outer join pm2.g3 on pm2.g2.e2 = pm2.g3.e2", RealMetadataFactory.example1Cached(), new String[] { "SELECT g_0.e1 AS c_0, g_0.e3 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT g_0.e1 AS c_0 FROM pm2.g2 AS g_0 LEFT OUTER JOIN pm2.g3 AS g_1 ON g_0.e2 = g_1.e2 ORDER BY c_0" }, new DefaultCapabilitiesFinder(caps), // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.
the class TestJoinOptimization method testLateralOnlyProcedurePushdown.
@Test
public void testLateralOnlyProcedurePushdown() throws Exception {
String sql = "select smallb.intkey, x.stringkey, x.intkey " + // $NON-NLS-1$
"from smallb left outer join lateral (select * from smalla where intkey = smallb.intkey) as x on (true)";
BasicSourceCapabilities bsc = TestOptimizer.getTypicalCapabilities();
bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
bsc.setCapabilitySupport(Capability.QUERY_FROM_JOIN_LATERAL, true);
bsc.setCapabilitySupport(Capability.QUERY_FROM_PROCEDURE_TABLE, true);
bsc.setCapabilitySupport(Capability.QUERY_ONLY_FROM_JOIN_LATERAL_PROCEDURE, true);
TransformationMetadata metadata = RealMetadataFactory.fromDDL("create foreign table smallb (intkey integer, stringkey string); " + "create foreign table smalla (intkey integer, stringkey string);", "x", "y");
TestOptimizer.helpPlan(sql, metadata, new String[] { "SELECT g_0.stringkey, g_0.intkey FROM y.smalla AS g_0 WHERE g_0.intkey = y.smallb.intkey", "SELECT g_0.intkey FROM y.smallb AS g_0" }, new DefaultCapabilitiesFinder(bsc), // $NON-NLS-1$ //$NON-NLS-2$
ComparisonMode.EXACT_COMMAND_STRING);
bsc.setCapabilitySupport(Capability.QUERY_ONLY_FROM_JOIN_LATERAL_PROCEDURE, false);
TestOptimizer.helpPlan(sql, metadata, new String[] { "SELECT g_0.intkey, v_0.c_0, v_0.c_1 FROM y.smallb AS g_0 LEFT OUTER JOIN LATERAL(SELECT g_1.stringkey AS c_0, g_1.intkey AS c_1 FROM y.smalla AS g_1 WHERE g_1.intkey = g_0.intkey) AS v_0 ON 1 = 1" }, new DefaultCapabilitiesFinder(bsc), // $NON-NLS-1$ //$NON-NLS-2$
ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder in project teiid by teiid.
the class TestJoinOptimization method testLeftOuterAssocitivtyLeftLinearWithPreserve.
@Test
public void testLeftOuterAssocitivtyLeftLinearWithPreserve() throws Exception {
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
// $NON-NLS-1$
TestOptimizer.helpPlan(// $NON-NLS-1$
"SELECT pm1.g1.e3 from /*+ preserve */ (pm1.g1 left outer join pm2.g2 on pm1.g1.e1 = pm2.g2.e1 left outer join pm2.g3 on pm2.g2.e2 = pm2.g3.e2)", RealMetadataFactory.example1Cached(), new String[] { "SELECT g_0.e1 AS c_0, g_0.e2 AS c_1 FROM pm2.g2 AS g_0 ORDER BY c_0", "SELECT g_0.e1 AS c_0, g_0.e3 AS c_1 FROM pm1.g1 AS g_0 ORDER BY c_0", "SELECT g_0.e2 AS c_0 FROM pm2.g3 AS g_0 ORDER BY c_0" }, new DefaultCapabilitiesFinder(caps), // $NON-NLS-1$
ComparisonMode.EXACT_COMMAND_STRING);
}
Aggregations