castorqin commented on code in PR #9029:
URL: https://github.com/apache/inlong/pull/9029#discussion_r1354806373


##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/cls/ClsResourceOperator.java:
##########
@@ -152,15 +205,87 @@ private void createTopicIndex(SinkInfo sinkInfo) throws 
BusinessException {
         CreateIndexRequest req = new CreateIndexRequest();
         req.setTopicId(clsSinkDTO.getTopicId());
         req.setRule(ruleInfo);
+        return req;
+    }
+
+    private void updateTopicIndex(SinkInfo sinkInfo, ClsDataNodeDTO 
clsDataNode) {
+        ClsClient clsClient = getClsClient(clsDataNode);
+        ClsSinkDTO clsSinkDTO = JsonUtils.parseObject(sinkInfo.getExtParams(), 
ClsSinkDTO.class);
+        RuleInfo ruleInfo = new RuleInfo();
+        FullTextInfo fullTextInfo1 = new FullTextInfo();
+        fullTextInfo1.setTokenizer(clsSinkDTO.getTokenizer());
+        ruleInfo.setFullText(fullTextInfo1);
+
+        ModifyIndexRequest req = new ModifyIndexRequest();
+        req.setTopicId(clsSinkDTO.getTopicId());
+        req.setRule(ruleInfo);
         try {
-            clsClient.CreateIndex(req);
+            clsClient.ModifyIndex(req);
         } catch (TencentCloudSDKException e) {
-            String errMsg = "Create cls topic index failed: " + e.getMessage();
+            String errMsg = "update cls topic index failed: " + e.getMessage();
             LOG.error(errMsg, e);
             sinkService.updateStatus(sinkInfo.getId(), 
SinkStatus.CONFIG_FAILED.getCode(), errMsg);
             throw new BusinessException(errMsg);
         }
-        LOG.info("topic {} create index success tokenizer is {}", 
clsSinkDTO.getTopicName(), clsSinkDTO.getTokenizer());
+    }
+
+    /**
+     * Describe cls topicId by topic name
+     */
+    private String describeTopicIDByTopicName(SinkInfo sinkInfo, 
ClsDataNodeDTO clsDataNode) {
+        ClsClient clsClient = getClsClient(clsDataNode);
+        ClsSinkDTO clsSinkDTO = JsonUtils.parseObject(sinkInfo.getExtParams(), 
ClsSinkDTO.class);
+        Filter[] filters = getDescribeFilters(clsDataNode, clsSinkDTO);
+        DescribeTopicsRequest req = new DescribeTopicsRequest();
+        req.setFilters(filters);
+        req.setPreciseSearch(PRECISE_SEARCH);
+        try {
+            DescribeTopicsResponse describeTopicsResponse = 
clsClient.DescribeTopics(req);
+            LOG.info("sink {} describe cls topic success topic count {}", 
sinkInfo.getSinkName(),

Review Comment:
   done



##########
inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/resource/sink/cls/ClsResourceOperator.java:
##########
@@ -169,7 +294,8 @@ private Tag[] convertTags(String[] allTags) {
             String tag = allTags[i];
             String[] keyAndValueOfTag = tag.split(InlongConstants.COLON);
             Tag tagInfo = new Tag();
-            tagInfo.set(keyAndValueOfTag[0], keyAndValueOfTag[1]);
+            tagInfo.setKey(keyAndValueOfTag[0]);

Review Comment:
   done



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

Reply via email to