ruanwenjun commented on code in PR #15452:
URL:
https://github.com/apache/dolphinscheduler/pull/15452#discussion_r1455660073
##########
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.xml:
##########
@@ -87,15 +87,20 @@
</include> ,
u.user_name as user_name,
count(distinct def.id) AS def_count,
- count(distinct inst.id) as inst_running_count
+ t.inst_running_count as inst_running_count
from t_ds_project p
left join t_ds_user u on u.id=p.user_id
left join t_ds_process_definition def
on def.project_code = p.code
- left join t_ds_process_instance inst
- on inst.process_definition_code = def.code
- and inst.process_definition_version = def.version
- and inst.state = 1
+ left join (select
+ COUNT(distinct inst.id) as inst_running_count, def.project_code code
+ from
+ t_ds_process_definition_log def
+ left join t_ds_process_instance inst on def.code =
inst.process_definition_code
+ and def.version = inst.process_definition_version
+ where
+ inst.state = 1
+ group by def.project_code) t on t.code = p.code
Review Comment:
Can we remove the join sql? It's difficult to maintain.
--
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]