fuchanghai commented on code in PR #14563:
URL:
https://github.com/apache/dolphinscheduler/pull/14563#discussion_r1274479144
##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/utils/DagHelper.java:
##########
@@ -424,19 +424,61 @@ private static List<Long> skipTaskNode4Switch(TaskNode
taskNode,
int resultConditionLocation =
switchParameters.getResultConditionLocation();
List<SwitchResultVo> conditionResultVoList =
switchParameters.getDependTaskList();
List<Long> switchTaskList =
conditionResultVoList.get(resultConditionLocation).getNextNode();
+ Set<Long> switchNeedWorkCodes = new HashSet<>();
if (CollectionUtils.isEmpty(switchTaskList)) {
switchTaskList = new ArrayList<>();
+ } else {
+ // get all downstream nodes of the branch that the switch node
needs to execute
+ for (Long switchTaskCode : switchTaskList) {
+ getSwitchNeedWorkCodes(switchTaskCode, dag,
switchNeedWorkCodes);
+ }
}
// conditionResultVoList.remove(resultConditionLocation);
for (SwitchResultVo info : conditionResultVoList) {
if (CollectionUtils.isEmpty(info.getNextNode())) {
continue;
}
- setTaskNodeSkip(info.getNextNode().get(0), dag, completeTaskList,
skipTaskNodeList);
+ setSwitchTaskNodeSkip(info.getNextNode().get(0), dag,
completeTaskList, skipTaskNodeList,
Review Comment:
hi @caishunfeng according to the front-end page, it seems that a
switchResult has only one nextNode. So in order to avoid ambiguity, use a loop
to traverse (instead of ``` get(0)```), what do you think?
--
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]