Search in sources :

Example 16 with NestedLoop

use of io.crate.planner.node.dql.join.NestedLoop in project crate by crate.

the class NestedLoopConsumerTest method testNoLimitPushDownWithJoinCondition.

@Test
public void testNoLimitPushDownWithJoinCondition() throws Exception {
    NestedLoop plan = plan("select * from information_schema.tables, information_schema .columns " + "where tables.table_schema = columns.table_schema " + "and tables.table_name = columns.table_name limit 10");
    assertThat(((Collect) plan.left()).collectPhase().projections().size(), is(0));
    assertThat(((Collect) plan.right()).collectPhase().projections().size(), is(0));
}
Also used : NestedLoop(io.crate.planner.node.dql.join.NestedLoop) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 17 with NestedLoop

use of io.crate.planner.node.dql.join.NestedLoop in project crate by crate.

the class NestedLoopConsumerTest method testAggregationOnNoMatch.

@Test
public void testAggregationOnNoMatch() throws Exception {
    // shouldn't result in a NoopPlan because aggregations still need to be executed
    NestedLoop nl = plan("select count(*) from users u1, users u2 where false");
    assertThat(nl.nestedLoopPhase().projections(), contains(instanceOf(EvalProjection.class), instanceOf(AggregationProjection.class), instanceOf(EvalProjection.class)));
}
Also used : NestedLoop(io.crate.planner.node.dql.join.NestedLoop) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 18 with NestedLoop

use of io.crate.planner.node.dql.join.NestedLoop in project crate by crate.

the class NestedLoopConsumerTest method testNoLimitPushDownWithJoinConditionOnDocTables.

@Test
public void testNoLimitPushDownWithJoinConditionOnDocTables() throws Exception {
    Merge merge = plan("select u1.name, u2.name from users u1, users u2 where u1.name = u2.name  order by 1, 2 limit 10");
    NestedLoop nl = (NestedLoop) merge.subPlan();
    assertThat(((Collect) nl.left()).collectPhase().projections().size(), is(0));
    assertThat(((Collect) nl.right()).collectPhase().projections().size(), is(0));
}
Also used : NestedLoop(io.crate.planner.node.dql.join.NestedLoop) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 19 with NestedLoop

use of io.crate.planner.node.dql.join.NestedLoop in project crate by crate.

the class NestedLoopConsumerTest method testGlobalAggWithWhereDoesNotResultInFilterProjection.

@Test
public void testGlobalAggWithWhereDoesNotResultInFilterProjection() throws Exception {
    NestedLoop nl = plan("select min(u1.name) from users u1, users u2 where u1.name like 'A%'");
    assertThat(nl.nestedLoopPhase().projections(), contains(instanceOf(EvalProjection.class), instanceOf(AggregationProjection.class), instanceOf(EvalProjection.class)));
}
Also used : NestedLoop(io.crate.planner.node.dql.join.NestedLoop) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Example 20 with NestedLoop

use of io.crate.planner.node.dql.join.NestedLoop in project crate by crate.

the class NestedLoopConsumerTest method testOrderByPushDown.

@SuppressWarnings("ConstantConditions")
@Test
public void testOrderByPushDown() throws Exception {
    QueryThenFetch qtf = plan("select u1.name, u2.name from users u1, users u2 order by u1.name");
    NestedLoop nl = (NestedLoop) qtf.subPlan();
    assertThat(nl.left().resultDescription(), instanceOf(Collect.class));
    Collect leftPlan = (Collect) nl.left();
    CollectPhase collectPhase = leftPlan.collectPhase();
    assertThat(collectPhase.projections().size(), is(0));
    assertThat(collectPhase.toCollect().get(0), isReference("name"));
}
Also used : NestedLoop(io.crate.planner.node.dql.join.NestedLoop) Test(org.junit.Test) CrateUnitTest(io.crate.test.integration.CrateUnitTest)

Aggregations

NestedLoop (io.crate.planner.node.dql.join.NestedLoop)20 CrateUnitTest (io.crate.test.integration.CrateUnitTest)20 Test (org.junit.Test)20 NestedLoopPhase (io.crate.planner.node.dql.join.NestedLoopPhase)3 Aggregation (io.crate.analyze.symbol.Aggregation)1 Symbol (io.crate.analyze.symbol.Symbol)1 QueryThenFetch (io.crate.planner.node.dql.QueryThenFetch)1