This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new fd43e0be66f Add AdvancedDistSQLUpdateExecutor (#32665)
fd43e0be66f is described below
commit fd43e0be66fda12d92a230acad363cb1650b139a
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 25 02:55:23 2024 +0800
Add AdvancedDistSQLUpdateExecutor (#32665)
---
.../update/AdvancedDistSQLUpdateExecutor.java | 30 ++++++++++++++++++++++
.../engine/update/DistSQLUpdateExecuteEngine.java | 3 ++-
2 files changed, 32 insertions(+), 1 deletion(-)
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 00000000000..675731e70ff
--- /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 <T> type of DistSQL statement
+ */
+@SingletonSPI
+public interface AdvancedDistSQLUpdateExecutor<T extends DistSQLStatement>
extends DistSQLUpdateExecutor<T> {
+}
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 64a14819206..aded74b6aee 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 @@ public final class DistSQLUpdateExecuteEngine {
@SuppressWarnings({"rawtypes", "unchecked"})
private void executeNormalUpdate() throws SQLException {
- DistSQLUpdateExecutor executor =
TypedSPILoader.getService(DistSQLUpdateExecutor.class, sqlStatement.getClass());
+ Optional<AdvancedDistSQLUpdateExecutor> 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);