use of org.teiid.query.processor.relational.LimitNode in project teiid by teiid.
the class TestMultiSourcePlanToProcessConverter method testMultiReplacementWithLimit1.
@Test
public void testMultiReplacementWithLimit1() throws Exception {
final QueryMetadataInterface metadata = RealMetadataFactory.exampleMultiBinding();
// $NON-NLS-1$
final String userSql = "SELECT a, b FROM MultiModel.Phys limit 1, 1";
// $NON-NLS-1$
final String multiModel = "MultiModel";
final int sources = 2;
final List<?>[] expected = new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z") };
final HardcodedDataManager dataMgr = new HardcodedDataManager();
// $NON-NLS-1$
dataMgr.addData(// $NON-NLS-1$
"SELECT g_0.a AS c_0, g_0.b AS c_1 FROM MultiModel.Phys AS g_0 LIMIT 2", new List<?>[] { // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("y", "z"), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Arrays.asList("x", "z") });
RelationalPlan plan = (RelationalPlan) helpTestMultiSourcePlan(metadata, userSql, multiModel, sources, dataMgr, expected, RealMetadataFactory.exampleMultiBindingVDB());
assertTrue(plan.getRootNode() instanceof LimitNode);
}
use of org.teiid.query.processor.relational.LimitNode in project teiid by teiid.
the class TestSortOptimization method testProjectionRaisingWithLimit1.
@Test
public void testProjectionRaisingWithLimit1() {
// Create query
// $NON-NLS-1$
String sql = "select (select e1 from pm2.g1 where e2 = x.e2) as z from pm1.g1 as x order by z limit 2";
RelationalPlan plan = (RelationalPlan) helpPlan(sql, RealMetadataFactory.example1Cached(), null, new DefaultCapabilitiesFinder(), new String[] { "SELECT pm1.g1.e2 FROM pm1.g1" }, // $NON-NLS-1$
TestOptimizer.SHOULD_SUCCEED);
assertTrue(plan.getRootNode() instanceof LimitNode);
}
use of org.teiid.query.processor.relational.LimitNode in project teiid by teiid.
the class CriteriaCapabilityValidatorVisitor method getAccessNode.
public static AccessNode getAccessNode(ProcessorPlan plan) {
if (!(plan instanceof RelationalPlan)) {
return null;
}
RelationalPlan rplan = (RelationalPlan) plan;
// Check that the plan is just an access node
RelationalNode accessNode = rplan.getRootNode();
if (accessNode instanceof LimitNode) {
LimitNode ln = (LimitNode) accessNode;
if (!ln.isImplicit()) {
return null;
}
accessNode = ln.getChildren()[0];
}
if (!(accessNode instanceof AccessNode)) {
return null;
}
return (AccessNode) accessNode;
}
Aggregations