You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/03/13 17:24:31 UTC

(shardingsphere) branch master updated: Refactor ShowComputeNodesExecutor (#34983)

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 0f9c7271b77 Refactor ShowComputeNodesExecutor (#34983)
0f9c7271b77 is described below

commit 0f9c7271b777e30fe97ea8ce20d0afd38a612bdd
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Mar 14 01:24:25 2025 +0800

    Refactor ShowComputeNodesExecutor (#34983)
---
 .../ral/queryable/computenode/ShowComputeNodesExecutor.java        | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutor.java
index 41c334ae90e..c6ad283cca3 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutor.java
@@ -43,9 +43,10 @@ public final class ShowComputeNodesExecutor implements DistSQLQueryExecutor<Show
     @Override
     public Collection<LocalDataQueryResultRow> getRows(final ShowComputeNodesStatement sqlStatement, final ContextManager contextManager) {
         String modeType = contextManager.getComputeNodeInstanceContext().getModeConfiguration().getType();
-        return "Standalone".equals(modeType)
-                ? Collections.singleton(buildRow(contextManager.getComputeNodeInstanceContext().getInstance(), modeType))
-                : contextManager.getPersistServiceFacade().getComputeNodePersistService().loadAllInstances().stream().map(each -> buildRow(each, modeType)).collect(Collectors.toList());
+        Collection<ComputeNodeInstance> instances = "Standalone".equals(modeType)
+                ? Collections.singleton(contextManager.getComputeNodeInstanceContext().getInstance())
+                : contextManager.getPersistServiceFacade().getComputeNodePersistService().loadAllInstances();
+        return instances.stream().map(each -> buildRow(each, modeType)).collect(Collectors.toList());
     }
     
     private LocalDataQueryResultRow buildRow(final ComputeNodeInstance instance, final String modeType) {