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


##########
seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/config/BeHostPortMapping.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.seatunnel.connectors.seatunnel.starrocks.config;
+
+import org.apache.seatunnel.api.configuration.util.OptionMark;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+public class BeHostPortMapping implements Serializable {
+    private static final long serialVersionUID = -1L;
+
+    @OptionMark(description = "The be host and be_port")
+    private String host_port;
+
+    @OptionMark(description = "The accessible ip and be_port")
+    private String ip_port;

Review Comment:
   done



##########
seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/source/StarRocksBeReadClient.java:
##########
@@ -69,8 +73,19 @@ public StarRocksBeReadClient(String beNodeInfo, SourceConfig 
sourceConfig) {
                     StarRocksConnectorErrorCode.CREATE_BE_READER_FAILED,
                     String.format("Format of StarRocks BE address[%s] is 
illegal", beNodeInfo));
         }
-        this.ip = hostPort[0].trim();
-        this.port = Integer.parseInt(hostPort[1].trim());
+
+        // If the user has configured beHostPortMapping, we need to parse it
+        Map<String, Pair<String, String>> beHostPortMapping = 
formatBeHostPortMapping(sourceConfig);
+
+        if (beHostPortMapping.containsKey(hostPort[0].trim())) {
+            Pair<String, String> accessIpPort = 
beHostPortMapping.get(hostPort[0].trim());
+            this.ip = accessIpPort.getKey();
+            this.port = Integer.parseInt(accessIpPort.getValue());
+        } else {
+            this.ip = hostPort[0].trim();
+            this.port = Integer.parseInt(hostPort[1].trim());
+        }

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