You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/05/16 09:24:04 UTC

[GitHub] [incubator-inlong] vernedeng commented on a diff in pull request #4200: [INLONG-4177][Manager] Refactor getClusterConfig interface

vernedeng commented on code in PR #4200:
URL: https://github.com/apache/incubator-inlong/pull/4200#discussion_r873510363


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/core/impl/SortServiceImpl.java:
##########
@@ -72,16 +72,17 @@ public SortClusterResponse getClusterConfig(String clusterName, String md5) {
         }
 
         // check if there is any task.
-        List<SortClusterConfigEntity> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);
+        List<SortTaskDTO> tasks = sortClusterConfigService.selectTasksByClusterName(clusterName);

Review Comment:
   fixed



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.inlong.manager.dao.mapper.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>

Review Comment:
   fixed



##########
inlong-manager/manager-dao/src/main/resources/mappers/SortClusterMapper.xml:
##########
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.apache.inlong.manager.dao.mapper.SortClusterMapper">
+    <resultMap id="SortTaskDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortTaskDTO">
+        <result column="sort_task_name" jdbcType="VARCHAR" property="sortTaskName"/>
+        <result column="sort_consumer_group" jdbcType="VARCHAR" property="sortConsumerGroup"/>
+        <result column="sink_type" jdbcType="VARCHAR" property="sinkType"/>
+        <result column="data_node_name" jdbcType="VARCHAR" property="dataNodeName"/>
+    </resultMap>
+    <resultMap id="SortSinkParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortSinkParamsDTO">
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="type" jdbcType="VARCHAR" property="type"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+    <resultMap id="SortIdParamsDTO" type="org.apache.inlong.common.pojo.sortstandalone.SortIdParamsDTO">
+        <result column="inlong_group_id" jdbcType="VARCHAR" property="inlongGroupId"/>
+        <result column="inlong_stream_id" jdbcType="VARCHAR" property="inlongStreamId"/>
+        <result column="ext_params" jdbcType="VARCHAR" property="extParams"/>
+    </resultMap>
+
+    <select id="selectTasksByClusterName" resultMap="SortTaskDTO">
+        select
+            sort_task_name, sort_consumer_group, sink_type, data_node_name
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="clusterName != null and clusterName != ''">
+                and inlong_cluster_name = #{clusterName, jdbcType=VARCHAR}
+            </if>
+        </where>
+        group by
+            sort_task_name, sink_type, sort_consumer_group, data_node_name
+    </select>
+
+    <select id="selectSinkParamsByNameAndType" resultMap="SortSinkParamsDTO">
+        select
+            name, type, ext_params
+        from data_node
+        <where>
+            is_deleted = 0
+            <if test="dataNodeName != null and dataNodeName != ''">
+                and name = #{dataNodeName, jdbcType=VARCHAR}
+            </if>
+            <if test="type != null and type != ''">
+                and type = #{type, jdbcType=VARCHAR}
+            </if>
+        </where>
+    </select>
+    
+    <select id="selectIdParamsByTaskName" resultMap="SortIdParamsDTO">
+        select
+            inlong_group_id, inlong_stream_id, ext_params
+        from stream_sink
+        <where>
+            is_deleted = 0
+            <if test="taskName != null and taskName != ''">
+                and sort_task_name = #{taskName, jdbcType=VARCHAR}
+            </if>

Review Comment:
   fixed



##########
inlong-common/src/main/java/org/apache/inlong/common/pojo/sortstandalone/SortTaskDTO.java:
##########
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+
+package org.apache.inlong.common.pojo.sortstandalone;
+
+import lombok.Data;
+
+@Data
+public class SortTaskDTO {
+    private static final long serialVersionUID = 1L;
+    String sortTaskName;

Review Comment:
   fixed



-- 
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@inlong.apache.org

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