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 2020/11/27 10:26:12 UTC

[GitHub] [incubator-dolphinscheduler] Rubik-W commented on a change in pull request #3940: [Improvement-3933][db operation] Improve the performance of sql query

Rubik-W commented on a change in pull request #3940:
URL: https://github.com/apache/incubator-dolphinscheduler/pull/3940#discussion_r531511187



##########
File path: dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapper.xml
##########
@@ -24,23 +24,24 @@
         left join t_ds_schedules tes on tepd.id = tes.process_definition_id
         where tepd.project_id = #{projectId}
         <if test="searchVal != null and searchVal != ''">
-            and  tepd.name like concat('%', #{searchVal}, '%')
+            and tepd.name like concat('%', #{searchVal}, '%')
         </if>
     </select>
     <select id="queryByIds" resultType="org.apache.dolphinscheduler.dao.entity.WorkFlowLineage" databaseId="mysql">
         select tepd.id as work_flow_id,tepd.name as work_flow_name,
-               (case when json_extract(tepd.process_definition_json, '$**.dependItemList') is not null then 1 else 0 end) as is_depend_work_flow,
-                          json_extract(tepd.process_definition_json, '$**.definitionId') as source_work_flow_id,
-                          tepd.release_state as work_flow_publish_status,
-                          tes.start_time as schedule_start_time,
-                          tes.end_time as schedule_end_time,
-                          tes.crontab as crontab,
-                          tes.release_state as schedule_publish_status
+        (case when json_extract(tepd.process_definition_json, '$**.dependItemList') is not null then 1 else 0 end) as

Review comment:
       Should keep the original format.

##########
File path: dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapper.xml
##########
@@ -24,23 +24,24 @@
         left join t_ds_schedules tes on tepd.id = tes.process_definition_id
         where tepd.project_id = #{projectId}
         <if test="searchVal != null and searchVal != ''">
-            and  tepd.name like concat('%', #{searchVal}, '%')
+            and tepd.name like concat('%', #{searchVal}, '%')
         </if>
     </select>
     <select id="queryByIds" resultType="org.apache.dolphinscheduler.dao.entity.WorkFlowLineage" databaseId="mysql">
         select tepd.id as work_flow_id,tepd.name as work_flow_name,
-               (case when json_extract(tepd.process_definition_json, '$**.dependItemList') is not null then 1 else 0 end) as is_depend_work_flow,
-                          json_extract(tepd.process_definition_json, '$**.definitionId') as source_work_flow_id,
-                          tepd.release_state as work_flow_publish_status,
-                          tes.start_time as schedule_start_time,
-                          tes.end_time as schedule_end_time,
-                          tes.crontab as crontab,
-                          tes.release_state as schedule_publish_status
+        (case when json_extract(tepd.process_definition_json, '$**.dependItemList') is not null then 1 else 0 end) as
+        is_depend_work_flow,
+        json_extract(tepd.process_definition_json, '$**.definitionId') as source_work_flow_id,
+        tepd.release_state as work_flow_publish_status,
+        tes.start_time as schedule_start_time,
+        tes.end_time as schedule_end_time,
+        tes.crontab as crontab,
+        tes.release_state as schedule_publish_status

Review comment:
       Should keep the original format.

##########
File path: dolphinscheduler-ui/src/js/conf/home/pages/security/pages/tenement/_source/createTenement.vue
##########
@@ -1,36 +1,36 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/

Review comment:
       Should keep the original format.

##########
File path: dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapper.xml
##########
@@ -49,39 +50,42 @@
 
     <select id="queryByIds" resultType="org.apache.dolphinscheduler.dao.entity.WorkFlowLineage" databaseId="pg">
         select a.work_flow_id,
-               a.work_flow_name,
-               a.is_depend_work_flow,
-               array_agg(a.source_id) as source_id,
-               a.work_flow_publish_status,
-               a.schedule_start_time,
-               a.schedule_end_time,
-               a.crontab,
-               a.schedule_publish_status
-         from (
-               select tepd.id as work_flow_id,tepd.name as work_flow_name,
-                      case when tepd.process_definition_json::json#>'{tasks,1,dependence}' is not null then 1 else 0 end as is_depend_work_flow,
-                      (json_array_elements(tepd.process_definition_json::json#>'{tasks}')#>>'{dependence,dependTaskList,0,dependItemList,0,definitionId}') as source_id,
-                      tepd.release_state as work_flow_publish_status,
-                      tes.start_time as schedule_start_time,
-                      tes.end_time as schedule_end_time,
-                      tes.crontab as crontab,
-                      tes.release_state as schedule_publish_status
-                 from t_ds_process_definition tepd
-                 left join t_ds_schedules tes on tepd.id = tes.process_definition_id
-                 where tepd.project_id = #{projectId}
-                 <if test="ids != null and ids.size()>0">
-                     and  tepd.id in
-                     <foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
-                     #{i}
-                     </foreach>
-                </if>
-             ) a
+        a.work_flow_name,
+        a.is_depend_work_flow,
+        array_agg(a.source_id) as source_id,
+        a.work_flow_publish_status,
+        a.schedule_start_time,
+        a.schedule_end_time,
+        a.crontab,
+        a.schedule_publish_status
+        from (
+        select tepd.id as work_flow_id,tepd.name as work_flow_name,
+        case when tepd.process_definition_json::json#>'{tasks,1,dependence}' is not null then 1 else 0 end as
+        is_depend_work_flow,
+        (json_array_elements(tepd.process_definition_json::json#>'{tasks}')#>>'{dependence,dependTaskList,0,dependItemList,0,definitionId}')
+        as source_id,
+        tepd.release_state as work_flow_publish_status,
+        tes.start_time as schedule_start_time,
+        tes.end_time as schedule_end_time,
+        tes.crontab as crontab,
+        tes.release_state as schedule_publish_status
+        from t_ds_process_definition tepd
+        left join t_ds_schedules tes on tepd.id = tes.process_definition_id
+        where tepd.project_id = #{projectId}
+        <if test="ids != null and ids.size()>0">
+            and tepd.id in
+            <foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
+                #{i}
+            </foreach>
+        </if>
+        ) a

Review comment:
       Should keep the original format.

##########
File path: dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/WorkFlowLineageMapper.xml
##########
@@ -49,39 +50,42 @@
 
     <select id="queryByIds" resultType="org.apache.dolphinscheduler.dao.entity.WorkFlowLineage" databaseId="pg">
         select a.work_flow_id,
-               a.work_flow_name,
-               a.is_depend_work_flow,
-               array_agg(a.source_id) as source_id,
-               a.work_flow_publish_status,
-               a.schedule_start_time,
-               a.schedule_end_time,
-               a.crontab,
-               a.schedule_publish_status
-         from (
-               select tepd.id as work_flow_id,tepd.name as work_flow_name,
-                      case when tepd.process_definition_json::json#>'{tasks,1,dependence}' is not null then 1 else 0 end as is_depend_work_flow,
-                      (json_array_elements(tepd.process_definition_json::json#>'{tasks}')#>>'{dependence,dependTaskList,0,dependItemList,0,definitionId}') as source_id,
-                      tepd.release_state as work_flow_publish_status,
-                      tes.start_time as schedule_start_time,
-                      tes.end_time as schedule_end_time,
-                      tes.crontab as crontab,
-                      tes.release_state as schedule_publish_status
-                 from t_ds_process_definition tepd
-                 left join t_ds_schedules tes on tepd.id = tes.process_definition_id
-                 where tepd.project_id = #{projectId}
-                 <if test="ids != null and ids.size()>0">
-                     and  tepd.id in
-                     <foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
-                     #{i}
-                     </foreach>
-                </if>
-             ) a
+        a.work_flow_name,
+        a.is_depend_work_flow,
+        array_agg(a.source_id) as source_id,
+        a.work_flow_publish_status,
+        a.schedule_start_time,
+        a.schedule_end_time,
+        a.crontab,
+        a.schedule_publish_status
+        from (
+        select tepd.id as work_flow_id,tepd.name as work_flow_name,
+        case when tepd.process_definition_json::json#>'{tasks,1,dependence}' is not null then 1 else 0 end as
+        is_depend_work_flow,
+        (json_array_elements(tepd.process_definition_json::json#>'{tasks}')#>>'{dependence,dependTaskList,0,dependItemList,0,definitionId}')
+        as source_id,
+        tepd.release_state as work_flow_publish_status,
+        tes.start_time as schedule_start_time,
+        tes.end_time as schedule_end_time,
+        tes.crontab as crontab,
+        tes.release_state as schedule_publish_status
+        from t_ds_process_definition tepd
+        left join t_ds_schedules tes on tepd.id = tes.process_definition_id
+        where tepd.project_id = #{projectId}
+        <if test="ids != null and ids.size()>0">
+            and tepd.id in
+            <foreach collection="ids" index="index" item="i" open="(" separator="," close=")">
+                #{i}
+            </foreach>
+        </if>
+        ) a
         where (a.is_depend_work_flow = 1 and source_id is not null) or (a.is_depend_work_flow = 0)
         group by a.work_flow_id,a.work_flow_name,a.is_depend_work_flow,a.work_flow_publish_status,a.schedule_start_time,
-                 a.schedule_end_time,a.crontab,a.schedule_publish_status
+        a.schedule_end_time,a.crontab,a.schedule_publish_status

Review comment:
       Should keep the original format.




----------------------------------------------------------------
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.

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