sdhzwc commented on code in PR #15945:
URL: 
https://github.com/apache/dolphinscheduler/pull/15945#discussion_r1595200789


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:
##########
@@ -760,8 +761,8 @@ private int createCommand(Long triggerCode, CommandType 
commandType, long proces
         if (warningType != null) {
             command.setWarningType(warningType);
         }
-        if (startParams != null && startParams.size() > 0) {
-            cmdParam.put(CMD_PARAM_START_PARAMS, 
JSONUtils.toJsonString(startParams));
+        if (startParamList != null && startParamList.size() > 0) {
+            cmdParam.put(CMD_PARAM_START_PARAMS, 
JSONUtils.toJsonString(startParamList));

Review Comment:
   > Use `CollectionUtils.isNotEmpty(startParamList)`
   
   done



##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java:
##########
@@ -163,9 +169,18 @@ public Result startProcessInstance(@Parameter(hidden = 
true) @RequestAttribute(v
         if (timeout == null) {
             timeout = Constants.MAX_TASK_TIMEOUT;
         }
-        Map<String, String> startParamMap = null;
+        List<Property> startParamList = null;
         if (startParams != null) {
-            startParamMap = JSONUtils.toMap(startParams);
+            JsonElement jsonElement = JsonParser.parseString(startParams);
+            boolean isJson = jsonElement.isJsonObject();
+            if (isJson) {
+                Map<String, String> startParamMap = 
JSONUtils.toMap(startParams);
+                startParamList = startParamMap.entrySet().stream()
+                        .map(entry -> new Property(entry.getKey(), Direct.IN, 
DataType.VARCHAR, entry.getValue()))
+                        .collect(Collectors.toList());
+            } else {
+                startParamList = JSONUtils.toList(startParams, Property.class);
+            }
         }

Review Comment:
   > Add a utils to transform the json to Propertity list
   
   done



-- 
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