use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testSubqueryRewriteToJoinExistsNoKey.
@Test
public void testSubqueryRewriteToJoinExistsNoKey() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm1.g1 x where exists (select 1 FROM pm1.g2 where pm1.g2.e1 = x.e1)", "SELECT e1 FROM pm1.g1 AS x, (SELECT DISTINCT pm1.g2.e1 FROM pm1.g2) AS X__1 WHERE x.e1 = X__1.e1", RealMetadataFactory.example4(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testSubqueryRewriteToJoinGroupBy.
/**
* Agg does not depend on cardinality
*/
@Test
public void testSubqueryRewriteToJoinGroupBy() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select max(e1) from pm1.g1 as x where exists (select pm1.g1.e1 FROM pm1.g1 where e1 = x.e1) group by e2", "SELECT MAX(e1) FROM pm1.g1 AS x, (SELECT e1 FROM pm1.g1) AS X__1 WHERE x.e1 = X__1.e1 GROUP BY e2", RealMetadataFactory.example1Cached(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestSubqueryPushdown method testSubqueryDoNotRewriteToJoin2.
@Test
public void testSubqueryDoNotRewriteToJoin2() throws Exception {
CommandContext cc = new CommandContext();
cc.setOptions(new Options().subqueryUnnestDefault(true));
TestQueryRewriter.helpTestRewriteCommand("Select e1 from pm3.g1 where e2 < some (select pm1.g1.e2 FROM pm1.g1)", "SELECT e1 FROM pm3.g1 WHERE e2 < (SELECT MAX(X.e2) FROM (SELECT pm1.g1.e2 FROM pm1.g1) AS X)", RealMetadataFactory.example4(), cc);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestOrderByProcessing method testNullOrdering2.
@Test
public void testNullOrdering2() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setCapabilitySupport(Capability.QUERY_ORDERBY_NULL_ORDERING, true);
caps.setSourceProperty(Capability.QUERY_ORDERBY_DEFAULT_NULL_ORDER, NullOrder.FIRST);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
CommandContext cc = new CommandContext();
cc.setOptions(new Options().pushdownDefaultNullOrder(true));
ProcessorPlan plan = TestOptimizer.getPlan(TestOptimizer.helpGetCommand("select e1 from pm1.g1 order by e1 desc, e2 asc NULLS LAST", metadata, null), metadata, capFinder, null, true, cc);
// $NON-NLS-1$
TestOptimizer.checkAtomicQueries(new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC NULLS LAST, g_0.e2 NULLS LAST" }, plan);
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
use of org.teiid.query.util.Options in project teiid by teiid.
the class TestOrderByProcessing method testNullOrdering3.
/**
* The engine will remove the null ordering if it's not needed
* @throws Exception
*/
@Test
public void testNullOrdering3() throws Exception {
FakeCapabilitiesFinder capFinder = new FakeCapabilitiesFinder();
BasicSourceCapabilities caps = TestOptimizer.getTypicalCapabilities();
caps.setSourceProperty(Capability.QUERY_ORDERBY_DEFAULT_NULL_ORDER, NullOrder.HIGH);
// $NON-NLS-1$
capFinder.addCapabilities("pm1", caps);
QueryMetadataInterface metadata = RealMetadataFactory.example1Cached();
CommandContext cc = new CommandContext();
cc.setOptions(new Options().pushdownDefaultNullOrder(true));
ProcessorPlan plan = TestOptimizer.getPlan(TestOptimizer.helpGetCommand("select e1 from pm1.g1 order by e1 desc, e2 asc NULLS LAST", metadata, null), metadata, capFinder, null, true, cc);
// $NON-NLS-1$
TestOptimizer.checkAtomicQueries(new String[] { "SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0 ORDER BY c_0 DESC, g_0.e2" }, plan);
TestOptimizer.checkNodeTypes(plan, TestOptimizer.FULL_PUSHDOWN);
}
Aggregations