Search in sources :

Example 46 with ProcessorPlan

use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.

the class TestOptimizer method testPushDistinctVirtual9.

@Test
public void testPushDistinctVirtual9() {
    ProcessorPlan plan = helpPlan(// $NON-NLS-1$
    "select DISTINCT * from vm1.g14 ORDER BY e1", // $NON-NLS-1$
    RealMetadataFactory.example1Cached(), // $NON-NLS-1$
    new String[] { "SELECT DISTINCT pm3.g1.e1, pm3.g1.e2, pm3.g1.e3, pm3.g1.e4 FROM pm3.g1 ORDER BY pm3.g1.e1" });
    checkNodeTypes(plan, FULL_PUSHDOWN);
}
Also used : ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Example 47 with ProcessorPlan

use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.

the class TestOptimizer method testPushDistinctSort.

@Test
public void testPushDistinctSort() {
    ProcessorPlan plan = helpPlan(// $NON-NLS-1$
    "select distinct e1 from pm3.g1 order by e1", // $NON-NLS-1$
    RealMetadataFactory.example1Cached(), // $NON-NLS-1$
    new String[] { "SELECT DISTINCT e1 FROM pm3.g1 ORDER BY e1" });
    checkNodeTypes(plan, FULL_PUSHDOWN);
}
Also used : ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Example 48 with ProcessorPlan

use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.

the class TestOptimizer method testCase6364.

@Test
public void testCase6364() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
    caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true);
    caps.setCapabilitySupport(Capability.QUERY_FUNCTIONS_IN_GROUP_BY, true);
    caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_SUM, true);
    // $NON-NLS-1$
    caps.setFunctionSupport("+", true);
    // $NON-NLS-1$
    capFinder.addCapabilities("BQT1", caps);
    // $NON-NLS-1$
    String sql = "select * from (SELECT 1+ SUM(intnum) AS s FROM bqt1.smalla) a WHERE a.s>10";
    ProcessorPlan plan = helpPlan(sql, RealMetadataFactory.exampleBQTCached(), null, capFinder, new String[] { "SELECT (1 + SUM(intnum)) FROM bqt1.smalla HAVING SUM(intnum) > 9" }, // $NON-NLS-1$
    TestOptimizer.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 49 with ProcessorPlan

use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.

the class TestOptimizer method testUnionAllPushdownVirtualGroup2.

@Test
public void testUnionAllPushdownVirtualGroup2() {
    FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
    BasicSourceCapabilities caps = new BasicSourceCapabilities();
    caps.setCapabilitySupport(Capability.QUERY_FROM_GROUP_ALIAS, true);
    caps.setCapabilitySupport(Capability.QUERY_FROM_JOIN_INNER, true);
    caps.setCapabilitySupport(Capability.QUERY_UNION, true);
    caps.setCapabilitySupport(Capability.QUERY_SET_ORDER_BY, true);
    // $NON-NLS-1$
    capFinder.addCapabilities("pm3", caps);
    ProcessorPlan plan = helpPlan(// $NON-NLS-1$
    "SELECT e2 FROM vm1.g17", // $NON-NLS-1$
    RealMetadataFactory.example1Cached(), null, capFinder, // $NON-NLS-1$
    new String[] { "SELECT pm3.g1.e2 FROM pm3.g1 UNION ALL SELECT pm3.g2.e2 FROM pm3.g2" }, 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 50 with ProcessorPlan

use of org.teiid.query.processor.ProcessorPlan in project teiid by teiid.

the class TestOptimizer method testCrossJoinNoElementCriteriaOptimization2.

/**
 * This tests that a criteria with no elements is not pushed down,
 * but instead is cleaned up properly later
 * See defect 9865
 */
@Test
public void testCrossJoinNoElementCriteriaOptimization2() {
    ProcessorPlan plan = helpPlan(// $NON-NLS-1$
    "select Y.e1, Y.e2 FROM vm1.g1 X, vm1.g1 Y where {b'true'} = {b'true'}", // $NON-NLS-1$
    example1(), // $NON-NLS-1$ //$NON-NLS-2$
    new String[] { "SELECT 1 FROM pm1.g1 AS g1__1", "SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1" });
    checkNodeTypes(plan, new int[] { // Access
    2, // DependentAccess
    0, // DependentSelect
    0, // DependentProject
    0, // DupRemove
    0, // Grouping
    0, // NestedLoopJoinStrategy
    1, // MergeJoinStrategy
    0, // Null
    0, // PlanExecution
    0, // Project
    1, // Select
    0, // Sort
    0, // UnionAll
    0 });
}
Also used : ProcessorPlan(org.teiid.query.processor.ProcessorPlan) Test(org.junit.Test)

Aggregations

ProcessorPlan (org.teiid.query.processor.ProcessorPlan)814 Test (org.junit.Test)764 BasicSourceCapabilities (org.teiid.query.optimizer.capabilities.BasicSourceCapabilities)357 FakeCapabilitiesFinder (org.teiid.query.optimizer.capabilities.FakeCapabilitiesFinder)290 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)177 List (java.util.List)112 TransformationMetadata (org.teiid.query.metadata.TransformationMetadata)108 ArrayList (java.util.ArrayList)99 HardcodedDataManager (org.teiid.query.processor.HardcodedDataManager)97 DefaultCapabilitiesFinder (org.teiid.query.optimizer.capabilities.DefaultCapabilitiesFinder)88 FakeDataManager (org.teiid.query.processor.FakeDataManager)86 TempMetadataStore (org.teiid.query.metadata.TempMetadataStore)33 TempMetadataAdapter (org.teiid.query.metadata.TempMetadataAdapter)32 CommandContext (org.teiid.query.util.CommandContext)26 Ignore (org.junit.Ignore)21 Command (org.teiid.query.sql.lang.Command)19 TeiidProcessingException (org.teiid.core.TeiidProcessingException)9 AnalysisRecord (org.teiid.query.analysis.AnalysisRecord)9 QueryPlannerException (org.teiid.api.exception.query.QueryPlannerException)8 CreateProcedureCommand (org.teiid.query.sql.proc.CreateProcedureCommand)8