Hisoka-X commented on code in PR #3631:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3631#discussion_r1046615226


##########
seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/client/DorisStreamLoadVisitor.java:
##########
@@ -0,0 +1,218 @@
+/*
+ * 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.doris.client;
+
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.common.utils.JsonUtils;
+import org.apache.seatunnel.connectors.doris.config.SinkConfig;
+import org.apache.seatunnel.connectors.doris.exception.DorisConnectorException;
+import org.apache.seatunnel.connectors.doris.util.DelimiterParserUtil;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+@Slf4j
+public class DorisStreamLoadVisitor {
+    private final HttpHelper httpHelper = new HttpHelper();
+    private static final int MAX_SLEEP_TIME = 5;
+
+    private final SinkConfig sinkConfig;
+    private long pos;
+    private static final String RESULT_FAILED = "Fail";
+    private static final String RESULT_SUCCESS = "Success";
+    private static final String RESULT_LABEL_EXISTED = "Label Already Exists";
+    private static final String LAEBL_STATE_VISIBLE = "VISIBLE";
+    private static final String LAEBL_STATE_COMMITTED = "COMMITTED";
+    private static final String RESULT_LABEL_PREPARE = "PREPARE";
+    private static final String RESULT_LABEL_ABORTED = "ABORTED";
+    private static final String RESULT_LABEL_UNKNOWN = "UNKNOWN";
+
+    private List<String> fieldNames;
+
+    public DorisStreamLoadVisitor(SinkConfig sinkConfig, List<String> 
fieldNames) {
+        this.sinkConfig = sinkConfig;
+        this.fieldNames = fieldNames;
+    }
+
+    public Boolean doStreamLoad(DorisFlushTuple flushData) throws IOException {
+        String host = getAvailableHost();
+        if (null == host) {
+            throw new 
DorisConnectorException(CommonErrorCode.ILLEGAL_ARGUMENT, "None of the host in 
`load_url` could be connected.");
+        }
+        String loadUrl = String.format("%s/api/%s/%s/_stream_load", host, 
sinkConfig.getDatabase(), sinkConfig.getTable());
+        if (log.isDebugEnabled()) {

Review Comment:
   Unnecessary use `log.isDebugEnabled()` to determine use `log.debug` or not. 
Because `log.debug` always print when debug mode enabled.



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