use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelRoot in project dingo by dingodb.
the class TestLogicalPlan method testTransfer.
@Test
public void testTransfer() throws SqlParseException {
String sql = "insert into test1 select id as id1, id as id2, id as id3, name, amount from test";
RelRoot relRoot = parse(sql);
Assert.relNode(relRoot.rel).isA(LogicalTableModify.class).convention(Convention.NONE).singleInput().isA(LogicalProject.class).convention(Convention.NONE).singleInput().isA(DingoTableScan.class).convention(DingoConventions.DINGO);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelRoot in project dingo by dingodb.
the class TestLogicalPlan method testFullScan.
@Test
public void testFullScan() throws SqlParseException {
String sql = "select * from test";
RelRoot relRoot = parse(sql);
Assert.relNode(relRoot.rel).isA(LogicalProject.class).convention(Convention.NONE).singleInput().isA(DingoTableScan.class).convention(DingoConventions.DINGO);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelRoot in project dingo by dingodb.
the class TestLogicalPlan method testAggregate.
@Test
public void testAggregate() throws SqlParseException {
String sql = "select count(*) from test";
RelRoot relRoot = parse(sql);
Assert.relNode(relRoot.rel).isA(LogicalAggregate.class).convention(Convention.NONE).singleInput().isA(DingoTableScan.class).convention(DingoConventions.DINGO);
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelRoot in project dingo by dingodb.
the class TestLogicalPlan method testInsertValues.
@Test
public void testInsertValues() throws SqlParseException {
String sql = "insert into test values(1, 'Alice', 1.0)";
RelRoot relRoot = parse(sql);
LogicalValues values = (LogicalValues) Assert.relNode(relRoot.rel).isA(LogicalTableModify.class).convention(Convention.NONE).prop("operation", TableModify.Operation.INSERT).singleInput().isA(LogicalValues.class).convention(Convention.NONE).getInstance();
List<? extends List<RexLiteral>> tuples = values.getTuples();
assertThat(tuples).size().isEqualTo(1);
List<RexLiteral> tuple = tuples.get(0);
assertThat(tuple).size().isEqualTo(3);
log.info("tuple = {}", tuple);
assertThat(tuple).element(0).hasFieldOrPropertyWithValue("value", BigDecimal.valueOf(1));
assertThat(tuple).element(1).hasFieldOrPropertyWithValue("value", new NlsString("Alice", DEFAULT_CHARSET.value(), new SqlCollation(SqlCollation.Coercibility.IMPLICIT)));
assertThat(tuple).element(2).hasFieldOrPropertyWithValue("value", BigDecimal.valueOf(1.0));
}
use of org.apache.beam.vendor.calcite.v1_28_0.org.apache.calcite.rel.RelRoot in project dingo by dingodb.
the class TestLogicalPlan method testAggregateGroup1.
@Test
public void testAggregateGroup1() throws SqlParseException {
String sql = "select sum(amount) from test group by name";
RelRoot relRoot = parse(sql);
Assert.relNode(relRoot.rel).isA(LogicalProject.class).convention(Convention.NONE).singleInput().isA(LogicalAggregate.class).convention(Convention.NONE).singleInput().isA(LogicalProject.class).convention(Convention.NONE).singleInput().isA(DingoTableScan.class).convention(DingoConventions.DINGO);
}
Aggregations