shaolei7788 commented on code in PR #18080:
URL: 
https://github.com/apache/dolphinscheduler/pull/18080#discussion_r2958253050


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-dinky/src/main/java/org/apache/dolphinscheduler/plugin/task/dinky/DinkyTask.java:
##########
@@ -339,24 +337,22 @@ public void cancelApplication() throws TaskException {
 
     private Map<String, String> generateVariables() {
         Map<String, String> variables = new ConcurrentHashMap<>();
-        List<Property> propertyList =
-                
GlobalParameterUtils.deserializeGlobalParameter(taskExecutionContext.getGlobalParams());
-        if (propertyList != null && !propertyList.isEmpty()) {
-            for (Property property : propertyList) {
-                variables.put(property.getProp(), property.getValue());
+        Map<String, Property> prepareParamsMap = 
taskExecutionContext.getPrepareParamsMap();
+        prepareParamsMap.forEach((key, property) -> {
+            if (property != null && property.getValue() != null) {
+                variables.put(key, property.getValue().trim());
             }
-        }
+        });
         List<Property> localParams = this.dinkyParameters.getLocalParams();
-        Map<String, Property> prepareParamsMap = 
taskExecutionContext.getPrepareParamsMap();
-        if (localParams == null || localParams.isEmpty()) {
-            return variables;
-        }
-        Map<String, String> convertMap = 
ParameterUtils.convert(prepareParamsMap);
-        for (Property property : localParams) {
-            String propertyValue = property.getValue();
-            String value = PlaceholderUtils.replacePlaceholders(propertyValue, 
convertMap, true);
-            variables.put(property.getProp(), value);
+        if (localParams != null) {
+            for (Property property : localParams) {
+                String value = 
ParameterUtils.convertParameterPlaceholders(property.getValue(), variables);
+                if (value != null && !value.isEmpty()) {
+                    variables.put(property.getProp(), value.trim());
+                }
+            }
         }
+        log.info("sending variables to dinky: {}", variables);

Review Comment:
   > Maybe directly use `taskExecutionContext.getPrepareParamsMap()` is enough?
   
   No,it is not enough. The time function is not converted.



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