diff --git a/fe/fe-core/src/main/java/com/starrocks/qe/ExecuteScriptExecutor.java b/fe/fe-core/src/main/java/com/starrocks/qe/ExecuteScriptExecutor.java index 389d4db6be6db..0f1458ec0736f 100644 --- a/fe/fe-core/src/main/java/com/starrocks/qe/ExecuteScriptExecutor.java +++ b/fe/fe-core/src/main/java/com/starrocks/qe/ExecuteScriptExecutor.java @@ -24,7 +24,7 @@ import com.starrocks.rpc.BackendServiceClient; import com.starrocks.server.GlobalStateMgr; import com.starrocks.sql.ast.ExecuteScriptStmt; -import com.starrocks.system.Backend; +import com.starrocks.system.ComputeNode; import com.starrocks.thrift.TNetworkAddress; import groovy.lang.Binding; import groovy.lang.GroovyShell; @@ -79,7 +79,7 @@ private static ShowResultSet executeFrontendScript(ExecuteScriptStmt stmt, Conne } private static ShowResultSet executeBackendScript(ExecuteScriptStmt stmt, ConnectContext ctx) throws UserException { - Backend be = GlobalStateMgr.getCurrentSystemInfo().getBackend(stmt.getBeId()); + ComputeNode be = GlobalStateMgr.getCurrentSystemInfo().getBackendOrComputeNode(stmt.getBeId()); if (be == null) { throw new UserException("node not found: " + stmt.getBeId()); } diff --git a/fe/fe-core/src/main/java/com/starrocks/system/SystemInfoService.java b/fe/fe-core/src/main/java/com/starrocks/system/SystemInfoService.java index adf3dd7caf2da..ad23937050f89 100644 --- a/fe/fe-core/src/main/java/com/starrocks/system/SystemInfoService.java +++ b/fe/fe-core/src/main/java/com/starrocks/system/SystemInfoService.java @@ -433,6 +433,14 @@ public ComputeNode getComputeNode(long computeNodeId) { return idToComputeNodeRef.get(computeNodeId); } + public ComputeNode getBackendOrComputeNode(long nodeId) { + ComputeNode backend = idToBackendRef.get(nodeId); + if (backend == null) { + backend = idToComputeNodeRef.get(nodeId); + } + return backend; + } + public boolean checkBackendAvailable(long backendId) { Backend backend = idToBackendRef.get(backendId); return backend != null && backend.isAvailable();