This is an automated email from the ASF dual-hosted git repository.

chufenggao pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 06b6ea81cf [Bug][Core] Fix query process instances by trigger code bug 
(#14528)
06b6ea81cf is described below

commit 06b6ea81cf9c6590b13fdfb373115fa14ca90f67
Author: Eric Gao <[email protected]>
AuthorDate: Thu Jul 13 16:56:04 2023 +0800

    [Bug][Core] Fix query process instances by trigger code bug (#14528)
    
    * Fix query process instances by trigger code bug
    
    * Add comment
---
 .../dao/mapper/ProcessInstanceMapper.xml           | 23 +++++++---------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git 
a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
 
b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
index 1748468dd5..8d4628d8f0 100644
--- 
a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
+++ 
b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml
@@ -28,16 +28,6 @@
         dry_run, test_flag, next_process_instance_id, restart_time, 
state_history
     </sql>
 
-    <sql id="baseSqlV2">
-        ${alias}.id
-        , ${alias}.name, ${alias}.process_definition_version, 
${alias}.process_definition_code, ${alias}.project_code, ${alias}.state, 
${alias}.recovery, ${alias}.start_time, ${alias}.end_time, 
${alias}.run_times,host,
-        command_type, ${alias}.command_param, ${alias}.task_depend_type, 
${alias}.max_try_times, ${alias}.failure_strategy, ${alias}.warning_type,
-        warning_group_id, ${alias}.schedule_time, ${alias}.command_start_time, 
${alias}.global_params, ${alias}.flag,
-        update_time, ${alias}.is_sub_process, ${alias}.executor_id, 
${alias}.history_cmd,
-        process_instance_priority, ${alias}.worker_group,environment_code, 
${alias}.timeout, ${alias}.tenant_code, ${alias}.var_pool,
-        dry_run, ${alias}.test_flag, ${alias}.next_process_instance_id, 
${alias}.restart_time, ${alias}.state_history
-    </sql>
-
     <select id="queryDetailById" 
resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
         select
         <include refid="baseSql"/>
@@ -366,13 +356,14 @@
           and next_process_instance_id = 0
     </update>
 
+<!-- There are some columns with the same names in both tables, we use a 
sub-query here to avoid ambiguity-->
     <select id="queryByTriggerCode" 
resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
         select
-        <include refid="baseSqlV2">
-            <property name="alias" value="b"/>
-        </include>
-        from t_ds_trigger_relation a
-        join   t_ds_process_instance b on a.job_id  = b.id
-        where a.trigger_type = 0 and a.trigger_code = #{triggerCode}
+        <include refid="baseSql"/>
+        from t_ds_process_instance a
+        join
+            (select trigger_type, job_id, trigger_code from 
t_ds_trigger_relation) b
+        on a.id = b.job_id
+        where b.trigger_type = 0 and b.trigger_code = #{triggerCode}
     </select>
 </mapper>

Reply via email to