Search in sources :

Example 1 with DingoTable

use of io.dingodb.calcite.DingoTable in project dingo by dingodb.

the class DingoPartModifyRule method checkUpdateInPart.

private static void checkUpdateInPart(@Nonnull DingoTableModify rel) {
    DingoTable table = rel.getTable().unwrap(DingoTable.class);
    assert table != null;
    TableDefinition td = table.getTableDefinition();
    List<String> updateList = rel.getUpdateColumnList();
    if (updateList != null && updateList.stream().anyMatch(c -> Objects.requireNonNull(td.getColumn(c)).isPrimary())) {
        throw new IllegalStateException("Update columns " + updateList + " contain primary columns and are not supported.");
    }
}
Also used : DingoTable(io.dingodb.calcite.DingoTable) DingoExchange(io.dingodb.calcite.rel.DingoExchange) RelOptCluster(org.apache.calcite.plan.RelOptCluster) DingoTableModify(io.dingodb.calcite.rel.DingoTableModify) TableDefinition(io.dingodb.common.table.TableDefinition) RelRule(org.apache.calcite.plan.RelRule) RelNode(org.apache.calcite.rel.RelNode) RelOptRuleCall(org.apache.calcite.plan.RelOptRuleCall) Objects(java.util.Objects) DingoConventions(io.dingodb.calcite.DingoConventions) List(java.util.List) DingoPartModify(io.dingodb.calcite.rel.DingoPartModify) DingoPartition(io.dingodb.calcite.rel.DingoPartition) DingoTable(io.dingodb.calcite.DingoTable) Nonnull(javax.annotation.Nonnull) TableDefinition(io.dingodb.common.table.TableDefinition)

Aggregations

DingoConventions (io.dingodb.calcite.DingoConventions)1 DingoTable (io.dingodb.calcite.DingoTable)1 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 TableDefinition (io.dingodb.common.table.TableDefinition)1 List (java.util.List)1 Objects (java.util.Objects)1 Nonnull (javax.annotation.Nonnull)1 RelOptCluster (org.apache.calcite.plan.RelOptCluster)1 RelOptRuleCall (org.apache.calcite.plan.RelOptRuleCall)1 RelRule (org.apache.calcite.plan.RelRule)1 RelNode (org.apache.calcite.rel.RelNode)1