Search in sources :

Example 1 with DingoDistributedValues

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

the class TestDingoJobVisitor method setupAll.

@BeforeAll
public static void setupAll() {
    parser = new DingoParser(new DingoParserContext());
    table = parser.getContext().getCatalogReader().getTable(ImmutableList.of(FULL_TABLE_NAME));
    RelOptCluster cluster = parser.getCluster();
    RelDataTypeFactory typeFactory = parser.getContext().getTypeFactory();
    RelDataType rowType = typeFactory.createStructType(ImmutableList.of(typeFactory.createSqlType(SqlTypeName.INTEGER), typeFactory.createSqlType(SqlTypeName.VARCHAR, 64), typeFactory.createSqlType(SqlTypeName.DOUBLE)), ImmutableList.of("id", "name", "amount"));
    values = new DingoValues(cluster, rowType, ImmutableList.of(new Object[] { 1, "Alice", 1.0 }, new Object[] { 2, "Betty", 2.0 }), cluster.traitSetOf(DingoConventions.ROOT));
    distributedValues = new DingoDistributedValues(cluster, rowType, values.getTuples(), cluster.traitSetOf(DingoConventions.DISTRIBUTED), table);
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) DingoParser(io.dingodb.calcite.DingoParser) DingoParserContext(io.dingodb.calcite.DingoParserContext) DingoDistributedValues(io.dingodb.calcite.rel.DingoDistributedValues) RelDataTypeFactory(org.apache.calcite.rel.type.RelDataTypeFactory) RelDataType(org.apache.calcite.rel.type.RelDataType) DingoValues(io.dingodb.calcite.rel.DingoValues) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with DingoDistributedValues

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

the class DingoDistributedValuesRule method onMatch.

@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
    DingoTableModify modify = call.rel(0);
    Values values = call.rel(1);
    RelOptCluster cluster = modify.getCluster();
    RelOptTable table = modify.getTable();
    call.transformTo(new DingoPartModify(cluster, modify.getTraitSet().replace(DingoConventions.DISTRIBUTED), new DingoDistributedValues(cluster, values.getRowType(), values.getTuples(), values.getTraitSet().replace(DingoConventions.DISTRIBUTED), table), table, modify.getOperation(), modify.getUpdateColumnList(), modify.getSourceExpressionList()));
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) DingoPartModify(io.dingodb.calcite.rel.DingoPartModify) DingoDistributedValues(io.dingodb.calcite.rel.DingoDistributedValues) Values(org.apache.calcite.rel.core.Values) DingoDistributedValues(io.dingodb.calcite.rel.DingoDistributedValues) DingoTableModify(io.dingodb.calcite.rel.DingoTableModify) RelOptTable(org.apache.calcite.plan.RelOptTable)

Aggregations

DingoDistributedValues (io.dingodb.calcite.rel.DingoDistributedValues)2 RelOptCluster (org.apache.calcite.plan.RelOptCluster)2 DingoParser (io.dingodb.calcite.DingoParser)1 DingoParserContext (io.dingodb.calcite.DingoParserContext)1 DingoPartModify (io.dingodb.calcite.rel.DingoPartModify)1 DingoTableModify (io.dingodb.calcite.rel.DingoTableModify)1 DingoValues (io.dingodb.calcite.rel.DingoValues)1 RelOptTable (org.apache.calcite.plan.RelOptTable)1 Values (org.apache.calcite.rel.core.Values)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1 RelDataTypeFactory (org.apache.calcite.rel.type.RelDataTypeFactory)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1