Search in sources :

Example 16 with FakeCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.

the class TestOptimizer method testCase2187.

@Test
public void testCase2187() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = new BasicSourceCapabilities();
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
    caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
    caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("BQT1", caps);
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    // $NON-NLS-1$
    String sql = "SELECT t.intkey FROM (SELECT a.IntKey FROM bqt1.smalla a left outer join bqt1.smallb b on a.intkey=b.intkey, bqt1.smalla x) as t full outer JOIN bqt1.smallb c on t.intkey = c.intkey";
    ProcessorPlan plan = helpPlan(sql, metadata, null, capFinder, // $NON-NLS-1$
    new String[] { "SELECT a.IntKey FROM ((bqt1.smalla AS a LEFT OUTER JOIN bqt1.smallb AS b ON a.intkey = b.intkey) CROSS JOIN bqt1.smalla AS x) FULL OUTER JOIN bqt1.smallb AS c ON a.IntKey = c.intkey" }, SHOULD_SUCCEED);
    checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Example 17 with FakeCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.

the class TestOptimizer method testCase3023.

@Test
public void testCase3023() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = new BasicSourceCapabilities();
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
    caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
    caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
    // $NON-NLS-1$
    caps.setFunctionSupport("concat", true);
    // $NON-NLS-1$
    capFinder.addCapabilities("BQT1", caps);
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    String sql = // $NON-NLS-1$
    "SELECT bqt1.SmallA.intkey from (bqt1.SmallA inner join (" + // $NON-NLS-1$
    "SELECT BAD.intkey from bqt1.SmallB as BAD left outer join bqt1.MediumB on BAD.intkey = bqt1.MediumB.intkey) as X on bqt1.SmallA.intkey = X.intkey) inner join bqt1.MediumA on X.intkey = bqt1.MediumA.intkey";
    helpPlan(sql, metadata, null, capFinder, // $NON-NLS-1$
    new String[] { "SELECT bqt1.SmallA.intkey FROM (bqt1.SmallA INNER JOIN (bqt1.SmallB AS BAD LEFT OUTER JOIN bqt1.MediumB ON BAD.intkey = bqt1.MediumB.intkey) ON bqt1.SmallA.intkey = BAD.intkey) INNER JOIN bqt1.MediumA ON BAD.intkey = bqt1.MediumA.intkey" }, SHOULD_SUCCEED);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) Test(org.junit.Test)

Example 18 with FakeCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.

the class TestOptimizer method testCase4312.

@Test
public void testCase4312() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = getTypicalCapabilities();
    caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
    // $NON-NLS-1$
    caps.setFunctionSupport("+", true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    helpPlan(// $NON-NLS-1$
    "select ? + 1, pm1.g1.e1 AS EXPR_1 FROM pm1.g1", // $NON-NLS-1$
    example1(), // $NON-NLS-1$
    null, // $NON-NLS-1$
    capFinder, new String[] { "SELECT (? + 1) AS expr, pm1.g1.e1 FROM pm1.g1" }, // $NON-NLS-1$
    true);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) Test(org.junit.Test)

Example 19 with FakeCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.

the class TestOptimizer method testPushGroupBy1.

@Test
public void testPushGroupBy1() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = new BasicSourceCapabilities();
    caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm1", caps);
    ProcessorPlan plan = helpPlan(// $NON-NLS-1$
    "SELECT e1, e2 as x FROM pm1.g1 GROUP BY e1, e2", RealMetadataFactory.example1Cached(), null, capFinder, // $NON-NLS-1$
    new String[] { "SELECT e1, e2 FROM pm1.g1 GROUP BY e1, e2" }, SHOULD_SUCCEED);
    checkNodeTypes(plan, FULL_PUSHDOWN);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Example 20 with FakeCapabilitiesFinder

use of org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder in project teiid by teiid.

the class TestOptimizer method testCase2507A.

@Test
public void testCase2507A() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = new BasicSourceCapabilities();
    caps.setCapabilitySupport(Capability.QUERY_SELECT_EXPRESSION, true);
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_EQ, true);
    caps.setCapabilitySupport(Capability.CRITERIA_COMPARE_ORDERED, true);
    caps.setCapabilitySupport(Capability.CRITERIA_IN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_OUTER_FULL, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_SELFJOIN, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
    caps.setCapabilitySupport(Capability.QUERY_ORDERBY, true);
    // $NON-NLS-1$
    caps.setFunctionSupport("concat", true);
    // $NON-NLS-1$
    capFinder.addCapabilities("BQT1", caps);
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    // $NON-NLS-1$
    String sql = "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) as EXPR, bqt1.smalla.stringKey as EXPR_1 FROM bqt1.smalla  ORDER BY EXPR, EXPR_1";
    ProcessorPlan plan = helpPlan(sql, metadata, null, capFinder, // $NON-NLS-1$
    new String[] { "SELECT CONCAT(bqt1.smalla.stringKey, bqt1.smalla.stringNum) AS EXPR, bqt1.smalla.stringKey AS EXPR_1 FROM bqt1.smalla ORDER BY EXPR, EXPR_1" }, SHOULD_SUCCEED);
    checkNodeTypes(plan, FULL_PUSHDOWN);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Aggregations

FakeCapabilitiesFinder (org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder)544 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)513 Test (org.junit.Test)497 ProcessorPlan (org.teiid.query.processor.ProcessorPlan)288 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)182 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)91 Command (org.teiid.query.sql.lang.Command)64 List (java.util.List)63 BigInteger (java.math.BigInteger)32 ArrayList (java.util.ArrayList)28 CommandContext (org.teiid.query.util.CommandContext)27 Schema (org.teiid.metadata.Schema)19 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)13 ColumnSet (org.teiid.metadata.ColumnSet)9 BigDecimal (java.math.BigDecimal)7 LinkedList (java.util.LinkedList)7 Column (org.teiid.metadata.Column)7 FunctionTree (org.teiid.query.function.FunctionTree)7 FakeFunctionMetadataSource (org.teiid.query.optimizer.FakeFunctionMetadataSource)6 FakeDataManager (org.teiid.query.processor.FakeDataManager)6