zhangshenghang commented on code in PR #10238:
URL: https://github.com/apache/seatunnel/pull/10238#discussion_r2659615086


##########
seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/source/StarRocksBeReadClient.java:
##########
@@ -91,6 +106,29 @@ public StarRocksBeReadClient(String beNodeInfo, 
SourceConfig sourceConfig) {
         client = new TStarrocksExternalService.Client(protocol);
     }
 
+    /**
+     * If the user has configured beHostPortMapping, we need to parse it
+     *
+     * @param sourceConfig sourceConfig
+     * @return <host, Pair<ip, port>>
+     */
+    private static Map<String, Pair<String, String>> formatBeHostPortMapping(
+            SourceConfig sourceConfig) {
+        return sourceConfig.getBeHostPortMapping().stream()
+                .collect(
+                        Collectors.toMap(
+                                mapping -> {
+                                    // host:be_port
+                                    String[] hostInfo = 
mapping.getHost_port().split(":");
+                                    return hostInfo[0];
+                                },
+                                mapping -> {
+                                    // accessible ip and be_port
+                                    String[] accessIpInfo = 
mapping.getIp_port().split(":");
+                                    return Pair.of(accessIpInfo[0], 
accessIpInfo[1]);
+                                }));
+    }

Review Comment:
   It is necessary to handle various abnormal configuration situations, such as 
missing colons, empty strings, null, etc.



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