You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2021/12/23 10:20:42 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a change in pull request #7579: [Feature-7572][Server & ui] Add Backward Dependent Execution

caishunfeng commented on a change in pull request #7579:
URL: https://github.com/apache/dolphinscheduler/pull/7579#discussion_r774467036



##########
File path: dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessTaskRelationMapper.xml
##########
@@ -183,4 +183,14 @@
             and post_task_code = #{postTaskCode}
         </if>
     </select>
+    <select id="queryDistinctDefineCodeByTaskCode" resultType="org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation">
+        select
+        process_definition_code
+        from t_ds_process_task_relation
+        WHERE pre_task_code = #{taskCode}
+        <if test="taskCode != 0">
+            or post_task_code = #{taskCode}

Review comment:
       I think it's better to split this sql instread of `or` query, which will dismatch index.

##########
File path: dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -2716,4 +2721,33 @@ private void deleteCommandWithCheck(int commandId) {
             throw new ServiceException("delete command fail, id:" + commandId);
         }
     }
+
+    public List<ProcessDefinition> getPostDependentProcessDefinitionByCode(long processDefinitionCode) throws JsonProcessingException {
+        List<ProcessDefinition> result = new ArrayList<>();
+        List<TaskDefinition> definitionList = taskDefinitionLogMapper.queryDefinitionListByTaskType(TaskType.DEPENDENT.getDesc());
+        for (TaskDefinition taskDefinition : definitionList) {
+            String dependence = taskDefinition.getDependence();
+            ArrayNode dependTaskList = (ArrayNode) new ObjectMapper().readTree(dependence).get("dependTaskList");

Review comment:
       It's better to use constant "dependTaskList"

##########
File path: dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
##########
@@ -2716,4 +2721,33 @@ private void deleteCommandWithCheck(int commandId) {
             throw new ServiceException("delete command fail, id:" + commandId);
         }
     }
+
+    public List<ProcessDefinition> getPostDependentProcessDefinitionByCode(long processDefinitionCode) throws JsonProcessingException {
+        List<ProcessDefinition> result = new ArrayList<>();
+        List<TaskDefinition> definitionList = taskDefinitionLogMapper.queryDefinitionListByTaskType(TaskType.DEPENDENT.getDesc());
+        for (TaskDefinition taskDefinition : definitionList) {
+            String dependence = taskDefinition.getDependence();
+            ArrayNode dependTaskList = (ArrayNode) new ObjectMapper().readTree(dependence).get("dependTaskList");
+            for (JsonNode dependTask : dependTaskList) {
+                ArrayNode dependItemList = (ArrayNode) dependTask.get("dependItemList");

Review comment:
       It's better to use constant




-- 
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: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org