Search in sources :

Example 6 with RelOptNode

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

the class TestPhysicalPlan method testGetByKeys1.

@Test
public void testGetByKeys1() throws SqlParseException {
    String sql = "select * from test1 where id0 = 1 and id1 = 'A' and id2 = true";
    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 });
}
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 7 with RelOptNode

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

the class TestPhysicalPlan method testGetByKeys2.

@Test
public void testGetByKeys2() throws SqlParseException {
    String sql = "select * from test1 where id0 = 1 and id1 = 'A' and not 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", false });
}
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)

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