Skip to content

Commit 0f9c727

Browse files
authored
Refactor ShowComputeNodesExecutor (#34983)
1 parent 4363dad commit 0f9c727

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/computenode/ShowComputeNodesExecutor.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ public Collection<String> getColumnNames(final ShowComputeNodesStatement sqlStat
4343
@Override
4444
public Collection<LocalDataQueryResultRow> getRows(final ShowComputeNodesStatement sqlStatement, final ContextManager contextManager) {
4545
String modeType = contextManager.getComputeNodeInstanceContext().getModeConfiguration().getType();
46-
return "Standalone".equals(modeType)
47-
? Collections.singleton(buildRow(contextManager.getComputeNodeInstanceContext().getInstance(), modeType))
48-
: contextManager.getPersistServiceFacade().getComputeNodePersistService().loadAllInstances().stream().map(each -> buildRow(each, modeType)).collect(Collectors.toList());
46+
Collection<ComputeNodeInstance> instances = "Standalone".equals(modeType)
47+
? Collections.singleton(contextManager.getComputeNodeInstanceContext().getInstance())
48+
: contextManager.getPersistServiceFacade().getComputeNodePersistService().loadAllInstances();
49+
return instances.stream().map(each -> buildRow(each, modeType)).collect(Collectors.toList());
4950
}
5051

5152
private LocalDataQueryResultRow buildRow(final ComputeNodeInstance instance, final String modeType) {

0 commit comments

Comments
 (0)