ruanwenjun commented on code in PR #15264:
URL: 
https://github.com/apache/dolphinscheduler/pull/15264#discussion_r1413137750


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TaskOutputParameterParser.java:
##########
@@ -36,46 +36,66 @@
 @NotThreadSafe
 public class TaskOutputParameterParser {
 
-    private final Map<String, String> taskOutputParams = new HashMap<>();
+    // Used to avoid '${setValue(' which loss the end of ')}'
+    private final int maxOneParameterRows;
+
+    private final Map<String, String> taskOutputParams;
 
     private List<String> currentTaskOutputParam;
 
-    public void appendParseLog(String log) {
-        if (log == null) {
+    public TaskOutputParameterParser() {
+        // the default max rows of one parameter is 1024, this should be enough
+        this(1024);

Review Comment:
   Good catch, but I added the maxLength for the parameter length, but this 
will work only when the parameter rows > 1, if the parameter exceeds the 
maxLength, then I will clear it and print an error log.
   
   I don't think we need to deal with the one-line case, since if the one line 
is very big, then it will already OOM before go into parser.



##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/TaskOutputParameterParser.java:
##########
@@ -36,46 +36,66 @@
 @NotThreadSafe
 public class TaskOutputParameterParser {
 
-    private final Map<String, String> taskOutputParams = new HashMap<>();
+    // Used to avoid '${setValue(' which loss the end of ')}'
+    private final int maxOneParameterRows;
+
+    private final Map<String, String> taskOutputParams;
 
     private List<String> currentTaskOutputParam;
 
-    public void appendParseLog(String log) {
-        if (log == null) {
+    public TaskOutputParameterParser() {
+        // the default max rows of one parameter is 1024, this should be enough
+        this(1024);

Review Comment:
   Good catch, I added the maxLength for the parameter length, but this will 
work only when the parameter rows > 1, if the parameter exceeds the maxLength, 
then I will clear it and print an error log.
   
   I don't think we need to deal with the one-line case, since if the one line 
is very big, then it will already OOM before go into parser.



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