TaoZex commented on code in PR #3958:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3958#discussion_r1070989267


##########
seatunnel-connectors-v2/connector-selectdb-cloud/src/main/java/org/apache/seatunnel/connector/selectdb/util/StringUtil.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * 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.connector.selectdb.util;
+
+public final class StringUtil {
+    public static boolean isNullOrWhitespaceOnly(String str) {
+        if (str != null && str.length() != 0) {
+            int len = str.length();
+
+            for (int i = 0; i < len; ++i) {
+                if (!Character.isWhitespace(str.charAt(i))) {
+                    return false;
+                }
+            }
+
+            return true;
+        } else {
+            return true;
+        }

Review Comment:
   ```suggestion
               return true;
   ```



##########
seatunnel-connectors-v2/connector-selectdb-cloud/src/main/java/org/apache/seatunnel/connector/selectdb/exception/SelectDBConnectorErrorCode.java:
##########
@@ -0,0 +1,45 @@
+/*
+ * 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.connector.selectdb.exception;
+
+import org.apache.seatunnel.common.exception.SeaTunnelErrorCode;
+
+public enum SelectDBConnectorErrorCode implements SeaTunnelErrorCode {
+    UPLOAD_FAILED("SelectDB-01", "upload failed "),
+
+    COMMIT_FAILED("SelectDB-02", "commit error with ");

Review Comment:
   Please add in this 
doc:https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/connector-v2/Error-Quick-Reference-Manual.md



##########
docs/en/connector-v2/sink/SelectDB-Cloud.md:
##########
@@ -0,0 +1,120 @@
+# SelectDB Cloud
+
+> SelectDB Cloud sink connector
+
+## Description
+Used to send data to SelectDB Cloud. Both support streaming and batch mode.
+The internal implementation of SelectDB Cloud sink connector upload after 
batch caching and commit the CopyInto sql to load data into the table.
+## Key features
+
+- [ ] [exactly-once](../../concept/connector-v2-features.md)
+
+## Options
+
+| name                        | type   | required | default value   |
+|-----------------------------|--------|----------|-----------------|
+| load-url                    | string | yes      | -               |
+| jdbc-url                    | string | yes      | -               |
+| cluster-name                | string | yes      | -               |
+| username                    | string | yes      | -               |
+| password                    | string | yes      | -               |
+| table.identifier            | string | yes      | -               |
+| sink.properties             | string | yes      | -               |

Review Comment:
   Change config prefix may be better.
   Please refer : https://github.com/apache/incubator-seatunnel/pull/3856



##########
seatunnel-connectors-v2/connector-selectdb-cloud/src/main/java/org/apache/seatunnel/connector/selectdb/sink/writer/SelectDBSinkWriter.java:
##########
@@ -0,0 +1,234 @@
+/*
+ * 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.connector.selectdb.sink.writer;
+
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import org.apache.seatunnel.api.sink.SinkWriter;
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.common.exception.CommonErrorCode;
+import org.apache.seatunnel.connector.selectdb.config.SelectDBConfig;
+import 
org.apache.seatunnel.connector.selectdb.exception.SelectDBConnectorException;
+import org.apache.seatunnel.connector.selectdb.serialize.SelectDBCsvSerializer;
+import 
org.apache.seatunnel.connector.selectdb.serialize.SelectDBJsonSerializer;
+import org.apache.seatunnel.connector.selectdb.serialize.SelectDBSerializer;
+import org.apache.seatunnel.connector.selectdb.util.HttpUtil;
+import 
org.apache.seatunnel.connector.selectdb.sink.committer.SelectDBCommitInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Collections;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+import static 
org.apache.seatunnel.connector.selectdb.sink.writer.LoadConstants.FORMAT_KEY;
+import static 
org.apache.seatunnel.connector.selectdb.sink.writer.LoadConstants.FIELD_DELIMITER_KEY;
+import static 
org.apache.seatunnel.connector.selectdb.sink.writer.LoadConstants.LINE_DELIMITER_KEY;
+import static 
org.apache.seatunnel.connector.selectdb.sink.writer.LoadConstants.LINE_DELIMITER_DEFAULT;
+
+public class SelectDBSinkWriter implements SinkWriter<SeaTunnelRow, 
SelectDBCommitInfo, SelectDBSinkState> {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(SelectDBSinkWriter.class);

Review Comment:
   Please use @slf4j.



##########
seatunnel-connectors-v2/connector-selectdb-cloud/src/main/java/org/apache/seatunnel/connector/selectdb/util/ResponseUtil.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * 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.connector.selectdb.util;
+
+import java.util.regex.Pattern;
+
+/**
+ * util for handle response.
+ */
+public class ResponseUtil {
+    public static final Pattern LABEL_EXIST_PATTERN =
+            Pattern.compile("errCode = 2, detailMessage = Label \\[(.*)\\] " +
+                    "has already been used, relate to txn \\[(\\d+)\\]");
+//    public static final Pattern COMMITTED_PATTERN =
+//            Pattern.compile("errCode = 2, detailMessage = transaction 
\\[(\\d+)\\] " +
+//                    "is already \\b(COMMITTED|committed|VISIBLE|visible)\\b, 
not pre-committed.");

Review Comment:
   Remove.



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