diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/AdvancedDistSQLUpdateExecutor.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/AdvancedDistSQLUpdateExecutor.java new file mode 100644 index 0000000000000..675731e70ffdc --- /dev/null +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/AdvancedDistSQLUpdateExecutor.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shardingsphere.distsql.handler.engine.update; + +import org.apache.shardingsphere.distsql.statement.DistSQLStatement; +import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI; + +/** + * Advanced DistSQL update executor. + * + * @param type of DistSQL statement + */ +@SingletonSPI +public interface AdvancedDistSQLUpdateExecutor extends DistSQLUpdateExecutor { +} diff --git a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/DistSQLUpdateExecuteEngine.java b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/DistSQLUpdateExecuteEngine.java index 64a14819206d7..aded74b6aee1b 100644 --- a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/DistSQLUpdateExecuteEngine.java +++ b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/engine/update/DistSQLUpdateExecuteEngine.java @@ -78,7 +78,8 @@ private void executeRuleDefinitionUpdate() throws SQLException { @SuppressWarnings({"rawtypes", "unchecked"}) private void executeNormalUpdate() throws SQLException { - DistSQLUpdateExecutor executor = TypedSPILoader.getService(DistSQLUpdateExecutor.class, sqlStatement.getClass()); + Optional advancedExecutor = TypedSPILoader.findService(AdvancedDistSQLUpdateExecutor.class, sqlStatement.getClass()); + DistSQLUpdateExecutor executor = advancedExecutor.isPresent() ? advancedExecutor.get() : TypedSPILoader.getService(DistSQLUpdateExecutor.class, sqlStatement.getClass()); ShardingSphereDatabase database = null == databaseName ? null : contextManager.getDatabase(databaseName); new DistSQLExecutorAwareSetter(executor).set(contextManager, database, null, sqlStatement); new DistSQLExecutorRequiredChecker(executor).check(sqlStatement, contextManager, database);