EricPyZhou commented on code in PR #12076:
URL:
https://github.com/apache/dolphinscheduler/pull/12076#discussion_r1004552114
##########
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessDefinitionMapper.xml:
##########
@@ -191,6 +191,22 @@
WHERE td.resource_ids is not null and td.resource_ids != '' and
td.user_id = #{userId}
</select>
+ <select id="queryResourcesInUseWithinResourceList"
resultType="java.util.HashMap">
+ SELECT distinct pd.code,td.resource_ids
+ FROM t_ds_process_task_relation ptr
+ join t_ds_process_definition pd
+ on ptr.process_definition_code=pd.code and
ptr.process_definition_version = pd.version
+ and ptr.project_code=pd.project_code and pd.release_state = 1
+ join t_ds_task_definition td
+ on (ptr.pre_task_code=td.code and ptr.pre_task_version=td.version)
+ or (ptr.post_task_code=td.code and ptr.post_task_version=td.version)
+ WHERE 1 = 1
+ and
+ <foreach item="item" index="index" collection="resourcesArray"
separator=" OR " >
+ td.resource_ids LIKE '%${item}%' and td.resource_ids != ''
+ </foreach>
+ </select>
Review Comment:
> This sql is complex, please split it.
> Avoid using `or` query, it will miss the index.
Right. This is part of the old logic to check what resources are currently
used by tasks. This logic were actually modified in this pull request,
therefore I delete it because this sql is not in use anymore.
--
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]