You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/04/28 14:31:56 UTC

[shardingsphere] branch master updated: Refactor YamlExecuteProcessContextSwapper (#25406)

This is an automated email from the ASF dual-hosted git repository.

panjuan 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 946a5364b90 Refactor YamlExecuteProcessContextSwapper (#25406)
946a5364b90 is described below

commit 946a5364b90a161e9360e65f21eaa6313e60f37e
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Apr 28 22:31:45 2023 +0800

    Refactor YamlExecuteProcessContextSwapper (#25406)
---
 ...reateShardingTableRuleStatementUpdaterTest.java |  5 +--
 .../process/yaml/YamlExecuteProcessContext.java    |  6 +--
 .../sql/process/yaml/YamlExecuteProcessUnit.java   |  2 -
 .../swapper/YamlExecuteProcessContextSwapper.java  |  8 ++--
 .../swapper/YamlExecuteProcessUnitSwapper.java     | 41 ------------------
 .../YamlAllExecuteProcessContextsSwapperTest.java  |  4 +-
 .../YamlExecuteProcessContextSwapperTest.java      |  4 +-
 .../swapper/YamlExecuteProcessUnitSwapperTest.java | 48 ----------------------
 .../route/engine/SingleStandardRouteEngine.java    |  2 +-
 .../ProcessListChangedSubscriberTest.java          |  2 +-
 .../admin/executor/ShowProcessListExecutor.java    | 22 +++++-----
 .../executor/ShowProcessListExecutorTest.java      |  7 +---
 12 files changed, 27 insertions(+), 124 deletions(-)

diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
index 277e16a63fc..b7080d9d265 100644
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
+++ b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleStatementUpdaterTest.java
@@ -18,9 +18,7 @@
 package org.apache.shardingsphere.sharding.distsql.update;
 
 import lombok.SneakyThrows;
-import org.antlr.v4.runtime.tree.ParseTreeVisitor;
 import org.apache.shardingsphere.distsql.handler.exception.DistSQLException;
-import org.apache.shardingsphere.sharding.exception.strategy.InvalidShardingStrategyConfigurationException;
 import org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade;
 import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
 import org.apache.shardingsphere.distsql.parser.statement.DistSQLStatement;
@@ -44,6 +42,7 @@ import org.apache.shardingsphere.sharding.distsql.parser.segment.table.AbstractT
 import org.apache.shardingsphere.sharding.distsql.parser.segment.table.AutoTableRuleSegment;
 import org.apache.shardingsphere.sharding.distsql.parser.segment.table.TableRuleSegment;
 import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
+import org.apache.shardingsphere.sharding.exception.strategy.InvalidShardingStrategyConfigurationException;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
 import org.apache.shardingsphere.sql.parser.core.SQLParserFactory;
@@ -292,7 +291,7 @@ class CreateShardingTableRuleStatementUpdaterTest {
         ShardingDistSQLStatementParserFacade facade = new ShardingDistSQLStatementParserFacade();
         ParseASTNode parseASTNode = (ParseASTNode) SQLParserFactory.newInstance(sql, facade.getLexerClass(), facade.getParserClass()).parse();
         SQLVisitor visitor = TypedSPILoader.getService(FeaturedDistSQLStatementParserFacade.class, facade.getType()).getVisitorClass().getDeclaredConstructor().newInstance();
-        return (DistSQLStatement) ((ParseTreeVisitor) visitor).visit(parseASTNode.getRootNode());
+        return (DistSQLStatement) visitor.visit(parseASTNode.getRootNode());
     }
     
     private static class MockDataSourceContainedRule implements DataSourceContainedRule {
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessContext.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessContext.java
index 8971cc84986..48f181eba82 100644
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessContext.java
+++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessContext.java
@@ -22,8 +22,6 @@ import lombok.Setter;
 import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessStatus;
 import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
 
-import java.util.Collection;
-
 /**
  * Execute process context for YAML.
  */
@@ -41,7 +39,9 @@ public final class YamlExecuteProcessContext implements YamlConfiguration {
     
     private String sql;
     
-    private Collection<YamlExecuteProcessUnit> unitStatuses;
+    private int totalUnitCount;
+    
+    private int completedUnitCount;
     
     private Long startTimeMillis;
     
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessUnit.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessUnit.java
index 8e43e3ee64b..4648d611310 100644
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessUnit.java
+++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/YamlExecuteProcessUnit.java
@@ -29,7 +29,5 @@ import org.apache.shardingsphere.infra.util.yaml.YamlConfiguration;
 @Setter
 public final class YamlExecuteProcessUnit implements YamlConfiguration {
     
-    private String unitID;
-    
     private ExecuteProcessStatus processStatus;
 }
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapper.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapper.java
index 3e5473b9aa7..a44d5cd9027 100644
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapper.java
+++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapper.java
@@ -18,18 +18,15 @@
 package org.apache.shardingsphere.infra.executor.sql.process.yaml.swapper;
 
 import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessContext;
+import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessStatus;
 import org.apache.shardingsphere.infra.executor.sql.process.yaml.YamlExecuteProcessContext;
 import org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
 
-import java.util.stream.Collectors;
-
 /**
  * YAML execute process context swapper.
  */
 public final class YamlExecuteProcessContextSwapper implements YamlConfigurationSwapper<YamlExecuteProcessContext, ExecuteProcessContext> {
     
-    private final YamlExecuteProcessUnitSwapper yamlExecuteProcessUnitSwapper = new YamlExecuteProcessUnitSwapper();
-    
     @Override
     public YamlExecuteProcessContext swapToYamlConfiguration(final ExecuteProcessContext data) {
         YamlExecuteProcessContext result = new YamlExecuteProcessContext();
@@ -38,7 +35,8 @@ public final class YamlExecuteProcessContextSwapper implements YamlConfiguration
         result.setUsername(data.getUsername());
         result.setHostname(data.getHostname());
         result.setSql(data.getSql());
-        result.setUnitStatuses(data.getProcessUnits().values().stream().map(yamlExecuteProcessUnitSwapper::swapToYamlConfiguration).collect(Collectors.toList()));
+        result.setTotalUnitCount(data.getProcessUnits().size());
+        result.setCompletedUnitCount(Long.valueOf(data.getProcessUnits().values().stream().filter(each -> ExecuteProcessStatus.DONE == each.getStatus()).count()).intValue());
         result.setStartTimeMillis(data.getStartMillis());
         result.setProcessStatus(data.getStatus());
         return result;
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapper.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapper.java
deleted file mode 100644
index 845acbe338b..00000000000
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapper.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.infra.executor.sql.process.yaml.swapper;
-
-import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessUnit;
-import org.apache.shardingsphere.infra.executor.sql.process.yaml.YamlExecuteProcessUnit;
-import org.apache.shardingsphere.infra.util.yaml.swapper.YamlConfigurationSwapper;
-
-/**
- * YAML execute process unit swapper.
- */
-public final class YamlExecuteProcessUnitSwapper implements YamlConfigurationSwapper<YamlExecuteProcessUnit, ExecuteProcessUnit> {
-    
-    @Override
-    public YamlExecuteProcessUnit swapToYamlConfiguration(final ExecuteProcessUnit data) {
-        YamlExecuteProcessUnit result = new YamlExecuteProcessUnit();
-        result.setUnitID(data.getUnitID());
-        result.setProcessStatus(data.getStatus());
-        return result;
-    }
-    
-    @Override
-    public ExecuteProcessUnit swapToObject(final YamlExecuteProcessUnit yamlConfig) {
-        throw new UnsupportedOperationException("YamlExecuteProcessUnitSwapper.swapToObject");
-    }
-}
diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlAllExecuteProcessContextsSwapperTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlAllExecuteProcessContextsSwapperTest.java
index e43232737a4..8d211ceba5c 100644
--- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlAllExecuteProcessContextsSwapperTest.java
+++ b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlAllExecuteProcessContextsSwapperTest.java
@@ -34,7 +34,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThanOrEqualTo;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class YamlAllExecuteProcessContextsSwapperTest {
     
@@ -54,7 +53,8 @@ class YamlAllExecuteProcessContextsSwapperTest {
         assertThat(actual.getUsername(), is("root"));
         assertThat(actual.getHostname(), is("localhost"));
         assertThat(actual.getSql(), is("SELECT 1"));
-        assertTrue(actual.getUnitStatuses().isEmpty());
+        assertThat(actual.getCompletedUnitCount(), is(0));
+        assertThat(actual.getTotalUnitCount(), is(0));
         assertThat(actual.getStartTimeMillis(), lessThanOrEqualTo(System.currentTimeMillis()));
         assertThat(actual.getProcessStatus(), is(ExecuteProcessStatus.START));
     }
diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapperTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapperTest.java
index 913a1effdf1..4183ce284e8 100644
--- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapperTest.java
+++ b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessContextSwapperTest.java
@@ -33,7 +33,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThanOrEqualTo;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 class YamlExecuteProcessContextSwapperTest {
     
@@ -48,7 +47,8 @@ class YamlExecuteProcessContextSwapperTest {
         assertThat(actual.getUsername(), is("root"));
         assertThat(actual.getHostname(), is("localhost"));
         assertThat(actual.getSql(), is("SELECT 1"));
-        assertTrue(actual.getUnitStatuses().isEmpty());
+        assertThat(actual.getCompletedUnitCount(), is(0));
+        assertThat(actual.getTotalUnitCount(), is(0));
         assertThat(actual.getStartTimeMillis(), lessThanOrEqualTo(System.currentTimeMillis()));
         assertThat(actual.getProcessStatus(), is(ExecuteProcessStatus.START));
     }
diff --git a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapperTest.java b/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapperTest.java
deleted file mode 100644
index 5ba9c8338d5..00000000000
--- a/infra/executor/src/test/java/org/apache/shardingsphere/infra/executor/sql/process/yaml/swapper/YamlExecuteProcessUnitSwapperTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.infra.executor.sql.process.yaml.swapper;
-
-import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
-import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit;
-import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessStatus;
-import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessUnit;
-import org.apache.shardingsphere.infra.executor.sql.process.yaml.YamlExecuteProcessUnit;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collections;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-
-class YamlExecuteProcessUnitSwapperTest {
-    
-    @Test
-    void assertSwapToYamlConfiguration() {
-        ExecuteProcessUnit executeProcessUnit = new ExecuteProcessUnit(new ExecutionUnit("foo_ds", new SQLUnit("SELECT 1", Collections.emptyList())), ExecuteProcessStatus.START);
-        YamlExecuteProcessUnit actual = new YamlExecuteProcessUnitSwapper().swapToYamlConfiguration(executeProcessUnit);
-        assertNotNull(actual.getUnitID());
-        assertThat(actual.getProcessStatus(), is(ExecuteProcessStatus.START));
-    }
-    
-    @Test
-    void assertSwapToObject() {
-        assertThrows(UnsupportedOperationException.class, () -> new YamlExecuteProcessUnitSwapper().swapToObject(new YamlExecuteProcessUnit()));
-    }
-}
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/route/engine/SingleStandardRouteEngine.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/route/engine/SingleStandardRouteEngine.java
index a729b2fc566..88f6d4d2e4f 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/route/engine/SingleStandardRouteEngine.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/route/engine/SingleStandardRouteEngine.java
@@ -82,7 +82,7 @@ public final class SingleStandardRouteEngine implements SingleRouteEngine {
             if (dataNodeOptional.isPresent() && containsIfNotExists) {
                 String dataSourceName = dataNodeOptional.map(DataNode::getDataSourceName).orElse(null);
                 routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(dataSourceName, dataSourceName), Collections.singleton(new RouteMapper(table.getTableName(), table.getTableName()))));
-            } else if (dataNodeOptional.isPresent() && !containsIfNotExists) {
+            } else if (dataNodeOptional.isPresent()) {
                 throw new TableExistsException(table.getTableName());
             } else {
                 String dataSourceName = rule.assignNewDataSourceName();
diff --git a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
index c74b2a4069f..ff0d89ea65a 100644
--- a/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
+++ b/mode/type/cluster/core/src/test/java/org/apache/shardingsphere/mode/manager/cluster/coordinator/subscriber/ProcessListChangedSubscriberTest.java
@@ -127,7 +127,7 @@ class ProcessListChangedSubscriberTest {
         subscriber.triggerShowProcessList(new ShowProcessListTriggerEvent(instanceId, processListId));
         ClusterPersistRepository repository = ((RegistryCenter) Plugins.getMemberAccessor().get(ProcessListChangedSubscriber.class.getDeclaredField("registryCenter"), subscriber)).getRepository();
         verify(repository).persist("/execution_nodes/foo_process_id/" + instanceId,
-                "contexts:" + System.lineSeparator() + "- startTimeMillis: 0" + System.lineSeparator());
+                "contexts:" + System.lineSeparator() + "- completedUnitCount: 0\n  startTimeMillis: 0\n  totalUnitCount: 0" + System.lineSeparator());
         verify(repository).delete("/nodes/compute_nodes/process_trigger/" + instanceId + ":foo_process_id");
     }
     
diff --git a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutor.java b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutor.java
index 0ceea1e489a..741bfbcbd14 100644
--- a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutor.java
+++ b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutor.java
@@ -93,22 +93,22 @@ public final class ShowProcessListExecutor implements DatabaseAdminQueryExecutor
         return new RawMemoryQueryResult(queryResultMetaData, rows);
     }
     
-    private static MemoryQueryResultDataRow getMemoryQueryResultDataRow(final YamlExecuteProcessContext processContext) {
+    private static MemoryQueryResultDataRow getMemoryQueryResultDataRow(final YamlExecuteProcessContext yamlExecuteProcessContext) {
         List<Object> rowValues = new ArrayList<>(8);
-        rowValues.add(processContext.getExecutionID());
-        rowValues.add(processContext.getUsername());
-        rowValues.add(processContext.getHostname());
-        rowValues.add(processContext.getDatabaseName());
-        rowValues.add(ExecuteProcessStatus.SLEEP == processContext.getProcessStatus() ? "Sleep" : "Execute");
-        rowValues.add(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - processContext.getStartTimeMillis()));
+        rowValues.add(yamlExecuteProcessContext.getExecutionID());
+        rowValues.add(yamlExecuteProcessContext.getUsername());
+        rowValues.add(yamlExecuteProcessContext.getHostname());
+        rowValues.add(yamlExecuteProcessContext.getDatabaseName());
+        rowValues.add(ExecuteProcessStatus.SLEEP == yamlExecuteProcessContext.getProcessStatus() ? "Sleep" : "Execute");
+        rowValues.add(TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - yamlExecuteProcessContext.getStartTimeMillis()));
         String sql = null;
-        if (ExecuteProcessStatus.SLEEP == processContext.getProcessStatus()) {
+        if (ExecuteProcessStatus.SLEEP == yamlExecuteProcessContext.getProcessStatus()) {
             rowValues.add("");
         } else {
-            int processDoneCount = processContext.getUnitStatuses().stream().map(each -> ExecuteProcessStatus.DONE == each.getProcessStatus() ? 1 : 0).reduce(0, Integer::sum);
+            int processDoneCount = yamlExecuteProcessContext.getCompletedUnitCount();
             String statePrefix = "Executing ";
-            rowValues.add(statePrefix + processDoneCount + "/" + processContext.getUnitStatuses().size());
-            sql = processContext.getSql();
+            rowValues.add(statePrefix + processDoneCount + "/" + yamlExecuteProcessContext.getTotalUnitCount());
+            sql = yamlExecuteProcessContext.getSql();
         }
         if (null != sql && sql.length() > 100) {
             sql = sql.substring(0, 100);
diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutorTest.java
index 33f269aab73..ac5e62d87d6 100644
--- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutorTest.java
+++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/ShowProcessListExecutorTest.java
@@ -70,11 +70,8 @@ class ShowProcessListExecutorTest {
                 + "  databaseName: sharding_db\n"
                 + "  username: sharding\n"
                 + "  hostname: 127.0.0.1\n"
-                + "  unitStatuses:\n"
-                + "  - processStatus: START\n"
-                + "    unitID: unitID1\n"
-                + "  - processStatus: DONE\n"
-                + "    unitID: unitID2\n";
+                + "  totalUnitCount: 2\n"
+                + "  completedUnitCount: 1\n";
         Plugins.getMemberAccessor().set(showProcessListExecutor.getClass().getDeclaredField("batchProcessContexts"), showProcessListExecutor, Collections.singleton(executionNodeValue));
     }
 }