You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/09/28 13:55:49 UTC

[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #2830: [Feature][Connector-V2]new connecotor of TiKV source and sink

hailin0 commented on code in PR #2830:
URL: https://github.com/apache/incubator-seatunnel/pull/2830#discussion_r982428905


##########
seatunnel-e2e/seatunnel-flink-connector-v2-e2e/connector-tikv-flink-e2e/src/test/resources/tikv/pd_tikv_contanner_docker_compose.yml:
##########
@@ -0,0 +1,24 @@
+version: '2.1'

Review Comment:
   remove this file



##########
seatunnel-connectors-v2/connector-tikv/src/main/java/org/apache/seatunnel/connectors/seatunnel/tikv/sink/TiKVSinkWriter.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.tikv.sink;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSinkWriter;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.ClientSession;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.TiKVDataType;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.TiKVParameters;
+
+import org.tikv.raw.RawKVClient;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class TiKVSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void> {
+
+    private final ClientSession clientSession;
+    private final TiKVParameters tikvParameters;
+    private final SeaTunnelRowType seaTunnelRowType;
+
+    public TiKVSinkWriter(SeaTunnelRowType seaTunnelRowType, TiKVParameters tikvParameters) {
+        this.tikvParameters = tikvParameters;
+        this.clientSession = new ClientSession(tikvParameters);
+        this.seaTunnelRowType = seaTunnelRowType;
+    }
+
+    @Override
+    public void write(SeaTunnelRow seaTunnelRow) {
+        RawKVClient client = clientSession.session.createRawClient();

Review Comment:
   Can it be reused?



##########
seatunnel-connectors-v2/connector-tikv/pom.xml:
##########
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>seatunnel-connectors-v2</artifactId>
+        <groupId>org.apache.seatunnel</groupId>
+        <version>${revision}</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>connector-tikv</artifactId>
+
+    <properties>
+        <tikv-client-java.version>3.3.0</tikv-client-java.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>connector-common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-format-json</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.seatunnel</groupId>
+            <artifactId>seatunnel-api</artifactId>

Review Comment:
   remove this  dependency
   
   https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-connectors-v2/pom.xml#L77



##########
seatunnel-connectors-v2/connector-tikv/src/main/java/org/apache/seatunnel/connectors/seatunnel/tikv/sink/TiKVSinkWriter.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.tikv.sink;
+
+import org.apache.seatunnel.api.table.type.SeaTunnelRow;
+import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
+import org.apache.seatunnel.connectors.seatunnel.common.sink.AbstractSinkWriter;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.ClientSession;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.TiKVDataType;
+import org.apache.seatunnel.connectors.seatunnel.tikv.config.TiKVParameters;
+
+import org.tikv.raw.RawKVClient;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+public class TiKVSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void> {
+
+    private final ClientSession clientSession;
+    private final TiKVParameters tikvParameters;
+    private final SeaTunnelRowType seaTunnelRowType;
+
+    public TiKVSinkWriter(SeaTunnelRowType seaTunnelRowType, TiKVParameters tikvParameters) {
+        this.tikvParameters = tikvParameters;
+        this.clientSession = new ClientSession(tikvParameters);
+        this.seaTunnelRowType = seaTunnelRowType;
+    }
+
+    @Override
+    public void write(SeaTunnelRow seaTunnelRow) {
+        RawKVClient client = clientSession.session.createRawClient();
+        TiKVDataType tikvDataType = tikvParameters.getTikvDataType();
+
+        // todo 需要兼容序列化不同类型的数据 只是key类型

Review Comment:
   use english?



##########
.idea/vcs.xml:
##########
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>

Review Comment:
   revert this file



-- 
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: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org