Search in sources :

Example 1 with RelOptNode

use of org.apache.calcite.plan.RelOptNode in project dingo by dingodb.

the class TestPhysicalPlan method testProjectScan.

@Test
public void testProjectScan() throws SqlParseException {
    String sql = "select name, amount from test";
    RelNode relNode = parse(sql);
    RelOptNode r = Assert.relNode(relNode).isA(EnumerableRoot.class).convention(EnumerableConvention.INSTANCE).singleInput().isA(DingoCoalesce.class).convention(DingoConventions.ROOT).singleInput().isA(DingoExchange.class).convention(DingoConventions.PARTITIONED).singleInput().isA(DingoPartScan.class).convention(DingoConventions.DISTRIBUTED).getInstance();
    DingoPartScan scan = (DingoPartScan) r;
    assertThat((scan).getFilter()).isNull();
    assertThat((scan).getSelection()).isNotNull();
}
Also used : RelNode(org.apache.calcite.rel.RelNode) AssertRelNode(io.dingodb.calcite.assertion.AssertRelNode) EnumerableRoot(io.dingodb.calcite.rel.EnumerableRoot) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) RelOptNode(org.apache.calcite.plan.RelOptNode) DingoExchange(io.dingodb.calcite.rel.DingoExchange) Test(org.junit.jupiter.api.Test)

Example 2 with RelOptNode

use of org.apache.calcite.plan.RelOptNode in project dingo by dingodb.

the class TestPhysicalPlan method testGetByKeys3.

@Test
public void testGetByKeys3() throws SqlParseException {
    String sql = "select * from test1 where (id0 = 1 or id0 = 2) and (id1 = 'A' or id1 = 'B') and id2";
    RelNode relNode = parse(sql);
    RelOptNode r = Assert.relNode(relNode).isA(EnumerableRoot.class).convention(EnumerableConvention.INSTANCE).singleInput().isA(DingoCoalesce.class).convention(DingoConventions.ROOT).singleInput().isA(DingoExchange.class).convention(DingoConventions.PARTITIONED).singleInput().isA(DingoGetByKeys.class).convention(DingoConventions.DISTRIBUTED).getInstance();
    assertThat((((DingoGetByKeys) r).getKeyTuples())).containsExactlyInAnyOrder(new Object[] { 1, "A", true }, new Object[] { 1, "B", true }, new Object[] { 2, "A", true }, new Object[] { 2, "B", true });
}
Also used : RelNode(org.apache.calcite.rel.RelNode) AssertRelNode(io.dingodb.calcite.assertion.AssertRelNode) EnumerableRoot(io.dingodb.calcite.rel.EnumerableRoot) RelOptNode(org.apache.calcite.plan.RelOptNode) DingoExchange(io.dingodb.calcite.rel.DingoExchange) Test(org.junit.jupiter.api.Test)

Example 3 with RelOptNode

use of org.apache.calcite.plan.RelOptNode in project dingo by dingodb.

the class TestPhysicalPlan method testFilterScan.

@Test
public void testFilterScan() throws SqlParseException {
    String sql = "select * from test where name = 'Alice' and amount > 3.0";
    RelNode relNode = parse(sql);
    RelOptNode r = Assert.relNode(relNode).isA(EnumerableRoot.class).convention(EnumerableConvention.INSTANCE).singleInput().isA(DingoCoalesce.class).convention(DingoConventions.ROOT).singleInput().isA(DingoExchange.class).convention(DingoConventions.PARTITIONED).singleInput().isA(DingoPartScan.class).convention(DingoConventions.DISTRIBUTED).getInstance();
    DingoPartScan scan = (DingoPartScan) r;
    assertThat((scan).getFilter()).isNotNull();
    assertThat((scan).getSelection()).isNull();
}
Also used : RelNode(org.apache.calcite.rel.RelNode) AssertRelNode(io.dingodb.calcite.assertion.AssertRelNode) EnumerableRoot(io.dingodb.calcite.rel.EnumerableRoot) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) RelOptNode(org.apache.calcite.plan.RelOptNode) DingoExchange(io.dingodb.calcite.rel.DingoExchange) Test(org.junit.jupiter.api.Test)

Example 4 with RelOptNode

use of org.apache.calcite.plan.RelOptNode in project dingo by dingodb.

the class TestPhysicalPlan method testGetByKeys.

@Test
public void testGetByKeys() throws SqlParseException {
    String sql = "select * from test1 where id0 = 1";
    RelNode relNode = parse(sql);
    RelOptNode r = Assert.relNode(relNode).isA(EnumerableRoot.class).convention(EnumerableConvention.INSTANCE).singleInput().isA(DingoCoalesce.class).convention(DingoConventions.ROOT).singleInput().isA(DingoExchange.class).convention(DingoConventions.PARTITIONED).singleInput().isA(DingoPartScan.class).convention(DingoConventions.DISTRIBUTED).getInstance();
    DingoPartScan scan = (DingoPartScan) r;
    assertThat((scan).getFilter()).isNotNull();
    assertThat((scan).getSelection()).isNull();
}
Also used : RelNode(org.apache.calcite.rel.RelNode) AssertRelNode(io.dingodb.calcite.assertion.AssertRelNode) EnumerableRoot(io.dingodb.calcite.rel.EnumerableRoot) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) RelOptNode(org.apache.calcite.plan.RelOptNode) DingoExchange(io.dingodb.calcite.rel.DingoExchange) Test(org.junit.jupiter.api.Test)

Example 5 with RelOptNode

use of org.apache.calcite.plan.RelOptNode in project dingo by dingodb.

the class TestPhysicalPlan method testFullScan.

@Test
public void testFullScan() throws SqlParseException {
    String sql = "select * from test";
    RelNode relNode = parse(sql);
    RelOptNode r = Assert.relNode(relNode).isA(EnumerableRoot.class).convention(EnumerableConvention.INSTANCE).singleInput().isA(DingoCoalesce.class).convention(DingoConventions.ROOT).singleInput().isA(DingoExchange.class).convention(DingoConventions.PARTITIONED).singleInput().isA(DingoPartScan.class).convention(DingoConventions.DISTRIBUTED).getInstance();
    DingoPartScan scan = (DingoPartScan) r;
    assertThat((scan).getFilter()).isNull();
    assertThat((scan).getSelection()).isNull();
}
Also used : RelNode(org.apache.calcite.rel.RelNode) AssertRelNode(io.dingodb.calcite.assertion.AssertRelNode) EnumerableRoot(io.dingodb.calcite.rel.EnumerableRoot) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) RelOptNode(org.apache.calcite.plan.RelOptNode) DingoExchange(io.dingodb.calcite.rel.DingoExchange) Test(org.junit.jupiter.api.Test)

Aggregations

AssertRelNode (io.dingodb.calcite.assertion.AssertRelNode)7 DingoExchange (io.dingodb.calcite.rel.DingoExchange)7 EnumerableRoot (io.dingodb.calcite.rel.EnumerableRoot)7 RelOptNode (org.apache.calcite.plan.RelOptNode)7 RelNode (org.apache.calcite.rel.RelNode)7 Test (org.junit.jupiter.api.Test)7 DingoPartScan (io.dingodb.calcite.rel.DingoPartScan)4