Search in sources :

Example 1 with DingoPartition

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

the class DingoPartModifyRule method onMatch.

@Override
public void onMatch(@Nonnull RelOptRuleCall call) {
    DingoTableModify rel = call.rel(0);
    RelNode input = rel.getInput();
    RelNode convertedInput = null;
    RelOptCluster cluster = rel.getCluster();
    switch(rel.getOperation()) {
        case INSERT:
            convertedInput = new DingoExchange(cluster, rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), new DingoPartition(cluster, rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), convert(input, DingoConventions.DISTRIBUTED), rel.getTable()));
            break;
        case UPDATE:
            // Only support update in part.
            checkUpdateInPart(rel);
            convertedInput = convert(input, DingoConventions.DISTRIBUTED);
            break;
        case DELETE:
            convertedInput = convert(input, DingoConventions.DISTRIBUTED);
            break;
        default:
            throw new IllegalStateException("Operation \"" + rel.getOperation() + "\" is not supported.");
    }
    call.transformTo(new DingoPartModify(cluster, rel.getTraitSet().replace(DingoConventions.DISTRIBUTED), convertedInput, rel.getTable(), rel.getOperation(), rel.getUpdateColumnList(), rel.getSourceExpressionList()));
}
Also used : RelOptCluster(org.apache.calcite.plan.RelOptCluster) RelNode(org.apache.calcite.rel.RelNode) DingoPartModify(io.dingodb.calcite.rel.DingoPartModify) DingoTableModify(io.dingodb.calcite.rel.DingoTableModify) DingoPartition(io.dingodb.calcite.rel.DingoPartition) DingoExchange(io.dingodb.calcite.rel.DingoExchange)

Aggregations

DingoExchange (io.dingodb.calcite.rel.DingoExchange)1 DingoPartModify (io.dingodb.calcite.rel.DingoPartModify)1 DingoPartition (io.dingodb.calcite.rel.DingoPartition)1 DingoTableModify (io.dingodb.calcite.rel.DingoTableModify)1 RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 RelNode (org.apache.calcite.rel.RelNode)1