Search in sources :

Example 81 with FakeCapabilitiesFinder

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);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder)

Example 82 with FakeCapabilitiesFinder

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);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) Test(org.junit.Test)

Example 83 with FakeCapabilitiesFinder

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);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) BasicSourceCapabilities(org.teiid.query.optimizer.capabilities.BasicSourceCapabilities) Test(org.junit.Test)

Example 84 with FakeCapabilitiesFinder

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);
}
Also used : FakeCapabilitiesFinder(org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder) Test(org.junit.Test)

Example 85 with FakeCapabilitiesFinder

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 });
}
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)

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