rickchengx commented on code in PR #12358:
URL: https://github.com/apache/dolphinscheduler/pull/12358#discussion_r996558897


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -3169,10 +3169,11 @@ public String findConfigYamlByName(String clusterName) {
         if (Strings.isNullOrEmpty(clusterName)) {
             return null;
         }
-        QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>();
-        nodeWrapper.eq("k8s_name", clusterName);
-        K8s k8s = k8sMapper.selectOne(nodeWrapper);
-        return k8s.getK8sConfig();
+
+        QueryWrapper<Cluster> nodeWrapper = new QueryWrapper<>();
+        nodeWrapper.eq("name", clusterName);
+        Cluster cluster = clusterMapper.selectOne(nodeWrapper);
+        return cluster.getConfig();

Review Comment:
   > It's better to write a sql rather than use `QueryWrapper`, and when the 
cluster is null here we might better return null rather than NPE?
   
   Hi, @ruanwenjun , thanks for the comment.
   
   1. I've changed `return cluster.getConfig();` to `return cluster == null ? 
null : cluster.getConfig();` to avoid the potential NPE.
   2. As for writing a SQL rather than using `QueryWrapper`, maybe we could do 
it in another PR? Since `QueryWrapper` is also used in many other places. Maybe 
we should fix this bug first since this NPE bug will cause the user cannot 
submit k8s tasks. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to