Search in sources :

Example 1 with DingoPartScan

use of io.dingodb.calcite.rel.DingoPartScan 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 DingoPartScan

use of io.dingodb.calcite.rel.DingoPartScan 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 3 with DingoPartScan

use of io.dingodb.calcite.rel.DingoPartScan 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 4 with DingoPartScan

use of io.dingodb.calcite.rel.DingoPartScan 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)

Example 5 with DingoPartScan

use of io.dingodb.calcite.rel.DingoPartScan in project dingo by dingodb.

the class TestDingoJobVisitor method testVisitPartScan.

@Test
public void testVisitPartScan() {
    RelOptCluster cluster = parser.getCluster();
    DingoPartScan partScan = new DingoPartScan(cluster, cluster.traitSetOf(DingoConventions.DISTRIBUTED), table);
    Job job = DingoJobVisitor.createJob(partScan);
    Assert.job(job).taskNum(2).task(0, t -> t.operatorNum(1).location(MockMetaServiceProvider.LOC_0).soleSource().isPartScan(TABLE_ID, "0").soleOutput().isNull()).task(1, t -> t.operatorNum(1).location(MockMetaServiceProvider.LOC_1).soleSource().isPartScan(TABLE_ID, "1").soleOutput().isNull());
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) DingoExchange(io.dingodb.calcite.rel.DingoExchange) RelDataTypeFactory(org.apache.calcite.rel.type.RelDataTypeFactory) DingoParserContext(io.dingodb.calcite.DingoParserContext) ValuesOperator(io.dingodb.exec.operator.ValuesOperator) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) Assert(io.dingodb.calcite.assertion.Assert) DingoDistributedValues(io.dingodb.calcite.rel.DingoDistributedValues) RelOptTable(org.apache.calcite.plan.RelOptTable) Job(io.dingodb.exec.base.Job) BigDecimal(java.math.BigDecimal) DingoConventions(io.dingodb.calcite.DingoConventions) DingoPartModify(io.dingodb.calcite.rel.DingoPartModify) ImmutableList(com.google.common.collect.ImmutableList) BeforeAll(org.junit.jupiter.api.BeforeAll) DingoCoalesce(io.dingodb.calcite.rel.DingoCoalesce) MockMetaServiceProvider(io.dingodb.calcite.mock.MockMetaServiceProvider) TableModify(org.apache.calcite.rel.core.TableModify) PartModifyOperator(io.dingodb.exec.operator.PartModifyOperator) RelOptCluster(org.apache.calcite.plan.RelOptCluster) RelDataType(org.apache.calcite.rel.type.RelDataType) SqlTypeName(org.apache.calcite.sql.type.SqlTypeName) TableId(io.dingodb.common.table.TableId) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) DingoParser(io.dingodb.calcite.DingoParser) SendOperator(io.dingodb.exec.operator.SendOperator) List(java.util.List) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) ReceiveOperator(io.dingodb.exec.operator.ReceiveOperator) DingoValues(io.dingodb.calcite.rel.DingoValues) CoalesceOperator(io.dingodb.exec.operator.CoalesceOperator) DingoPartScan(io.dingodb.calcite.rel.DingoPartScan) Job(io.dingodb.exec.base.Job) Test(org.junit.jupiter.api.Test)

Aggregations

DingoPartScan (io.dingodb.calcite.rel.DingoPartScan)8 DingoExchange (io.dingodb.calcite.rel.DingoExchange)7 Test (org.junit.jupiter.api.Test)7 AssertRelNode (io.dingodb.calcite.assertion.AssertRelNode)4 EnumerableRoot (io.dingodb.calcite.rel.EnumerableRoot)4 RelOptNode (org.apache.calcite.plan.RelOptNode)4 RelNode (org.apache.calcite.rel.RelNode)4 ImmutableList (com.google.common.collect.ImmutableList)3 DingoConventions (io.dingodb.calcite.DingoConventions)3 DingoParser (io.dingodb.calcite.DingoParser)3 DingoParserContext (io.dingodb.calcite.DingoParserContext)3 Assert (io.dingodb.calcite.assertion.Assert)3 MockMetaServiceProvider (io.dingodb.calcite.mock.MockMetaServiceProvider)3 DingoCoalesce (io.dingodb.calcite.rel.DingoCoalesce)3 DingoDistributedValues (io.dingodb.calcite.rel.DingoDistributedValues)3 DingoPartModify (io.dingodb.calcite.rel.DingoPartModify)3 DingoValues (io.dingodb.calcite.rel.DingoValues)3 TableId (io.dingodb.common.table.TableId)3 Job (io.dingodb.exec.base.Job)3 CoalesceOperator (io.dingodb.exec.operator.CoalesceOperator)3