You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/09/29 11:07:15 UTC

[GitHub] [inlong] liaorui opened a new pull request, #6067: Support generating DTS TDSQL-Kafka Connector Flink SQL

liaorui opened a new pull request, #6067:
URL: https://github.com/apache/inlong/pull/6067

   ### Prepare a Pull Request
   *(Change the title refer to the following example)*
   
   - Title Example: [INLONG-XYZ][Component] Title of the pull request
   
   *(The following *XYZ* should be replaced by the actual [GitHub Issue](https://github.com/apache/inlong/issues) number)*
   
   - Fixes #6061
   
   ### Motivation
   
   *Explain here the context, and why you're making that change. What is the problem you're trying to solve?*
   
   ### Modifications
   
   *Describe the modifications you've done.*
   
   ### Verifying this change
   
   *(Please pick either of the following options)*
   
   - [ ] This change is a trivial rework/code cleanup without any test coverage.
   
   - [ ] This change is already covered by existing tests, such as:
     *(please describe tests)*
   
   - [ ] This change added tests and can be verified as follows:
   
     *(example:)*
     - *Added integration tests for end-to-end deployment with large payloads (10MB)*
     - *Extended integration test for recovery after broker failure*
   
   ### Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
     - If a feature is not applicable for documentation, explain why?
     - If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation
   


-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r990572691


##########
inlong-common/src/main/java/org/apache/inlong/common/enums/TaskTypeEnum.java:
##########
@@ -31,6 +31,9 @@ public enum TaskTypeEnum {
     MONGODB(9),
     TUBEMQ(10),
     REDIS(11),
+    CKAFKA(12),
+    TDSQL_KAFKA(14),

Review Comment:
   Why no `13` here?



-- 
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@inlong.apache.org

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


[GitHub] [inlong] EMsnap commented on a diff in pull request #6067: [INLONG-6061][Sort]Support generating DTS TDSQL-Kafka Connector Flink SQL

Posted by GitBox <gi...@apache.org>.
EMsnap commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r983408952


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/ProtobufFormat.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.inlong.sort.protocol.node.format;
+
+import java.util.HashMap;
+import java.util.Map;
+import lombok.Data;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * The protobuf format.
+ *
+ */
+@JsonTypeName("protobufFormat")
+@Data
+public class ProtobufFormat implements Format {
+
+    private static final long serialVersionUID = 1L;
+
+    @JsonProperty(value = "codec")
+    private String codec;
+
+    @JsonCreator
+    public ProtobufFormat(@JsonProperty(value = "codec") String codec) {
+        this.codec = codec;
+    }
+
+    @JsonCreator
+    public ProtobufFormat() {
+    }
+
+    /**
+     * Return avro

Review Comment:
   doc doesn't match code



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984346540


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TDSQLKafkaExtractNode.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TDSQLKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka
+ */
+@EqualsAndHashCode(callSuper = true)
+@JsonTypeName("tdsqlKafkaExtract")
+public class TDSQLKafkaExtractNode extends KafkaExtractNode implements InlongMetric, Metadata, Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public TDSQLKafkaExtractNode(@JsonProperty("id") String id,
+            @JsonProperty("name") String name,
+            @JsonProperty("fields") List<FieldInfo> fields,
+            @Nullable @JsonProperty("watermarkField") WatermarkField watermarkField,
+            @JsonProperty("properties") Map<String, String> properties,
+            @Nonnull @JsonProperty("topic") String topic,
+            @Nonnull @JsonProperty("bootstrapServers") String bootstrapServers,
+            @Nonnull @JsonProperty("format") Format format,
+            @JsonProperty("scanStartupMode") KafkaScanStartupMode kafkaScanStartupMode,
+            @JsonProperty("primaryKey") String primaryKey,
+            @JsonProperty("groupId") String groupId,
+            @JsonProperty("scanSpecificOffsets") String scanSpecificOffsets) {
+        super(id, name, fields, watermarkField, properties, topic, bootstrapServers, format, kafkaScanStartupMode,
+                primaryKey, groupId, scanSpecificOffsets);
+    }
+
+    /**
+     * generate table options
+     *
+     * @return options
+     */
+    @Override
+    public Map<String, String> tableOptions() {
+        Map<String, String> options = new LinkedHashMap<>();
+        if (getProperties() != null && !getProperties().isEmpty()) {
+            options.putAll(getProperties());
+        }
+        options.put(TDSQLKafkaConstant.TOPIC, getTopic());
+        options.put(TDSQLKafkaConstant.PROPERTIES_BOOTSTRAP_SERVERS, getBootstrapServers());
+        if (getFormat() instanceof ProtobufFormat) {
+            options.put(TDSQLKafkaConstant.CONNECTOR, TDSQLKafkaConstant.TDSQL_SUBSCRIBE);
+            options.put(TDSQLKafkaConstant.SCAN_STARTUP_MODE, getKafkaScanStartupMode().getValue());
+            if (StringUtils.isNotEmpty(getScanSpecificOffsets())) {
+                options.put(TDSQLKafkaConstant.SCAN_STARTUP_SPECIFIC_OFFSETS, getScanSpecificOffsets());
+            }
+            options.putAll(getFormat().generateOptions(false));
+        } else {
+            throw new IllegalArgumentException("tdsql kafka extract node format is IllegalArgument");
+        }

Review Comment:
   ```suggestion
           if (!(getFormat() instanceof ProtobufFormat)) {
               throw new IllegalArgumentException("tdsql kafka extract node format is IllegalArgument");
           }
   
           options.put(TDSQLKafkaConstant.CONNECTOR, TDSQLKafkaConstant.TDSQL_SUBSCRIBE);
           options.put(TDSQLKafkaConstant.SCAN_STARTUP_MODE, getKafkaScanStartupMode().getValue());
           if (StringUtils.isNotEmpty(getScanSpecificOffsets())) {
               options.put(TDSQLKafkaConstant.SCAN_STARTUP_SPECIFIC_OFFSETS, getScanSpecificOffsets());
           }
           options.putAll(getFormat().generateOptions(false));
   ```



-- 
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@inlong.apache.org

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


[GitHub] [inlong] gong commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984190461


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TdsqlKafkaExtractNode.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TdsqlKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka
+ */
+@EqualsAndHashCode(callSuper = true)
+@JsonTypeName("tdsqlKafkaExtract")
+public class TdsqlKafkaExtractNode extends KafkaExtractNode implements InlongMetric, Metadata, Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public TdsqlKafkaExtractNode(@JsonProperty("id") String id,
+            @JsonProperty("name") String name,
+            @JsonProperty("fields") List<FieldInfo> fields,
+            @Nullable @JsonProperty("watermarkField") WatermarkField watermarkField,
+            @JsonProperty("properties") Map<String, String> properties,
+            @Nonnull @JsonProperty("topic") String topic,
+            @Nonnull @JsonProperty("bootstrapServers") String bootstrapServers,
+            @Nonnull @JsonProperty("format") Format format,
+            @JsonProperty("scanStartupMode") KafkaScanStartupMode kafkaScanStartupMode,
+            @JsonProperty("primaryKey") String primaryKey,
+            @JsonProperty("groupId") String groupId,
+            @JsonProperty("scanSpecificOffsets") String scanSpecificOffsets) {
+        super(id, name, fields, watermarkField, properties, topic, bootstrapServers, format, kafkaScanStartupMode,
+                primaryKey, groupId, scanSpecificOffsets);
+    }
+
+    /**
+     * generate table options
+     *
+     * @return options
+     */
+    @Override
+    public Map<String, String> tableOptions() {
+        Map<String, String> options = new LinkedHashMap<>();
+        if (getProperties() != null && !getProperties().isEmpty()) {
+            options.putAll(getProperties());
+        }
+        options.put(TdsqlKafkaConstant.TOPIC, getTopic());
+        options.put(TdsqlKafkaConstant.PROPERTIES_BOOTSTRAP_SERVERS, getBootstrapServers());
+        if (getFormat() instanceof ProtobufFormat) {
+            options.put(TdsqlKafkaConstant.CONNECTOR, TdsqlKafkaConstant.TDSQL_SUBSCRIBE);
+            options.put(TdsqlKafkaConstant.SCAN_STARTUP_MODE, getKafkaScanStartupMode().getValue());
+            if (StringUtils.isNotEmpty(getScanSpecificOffsets())) {
+                options.put(TdsqlKafkaConstant.SCAN_STARTUP_SPECIFIC_OFFSETS, getScanSpecificOffsets());
+            }
+            options.putAll(getFormat().generateOptions(false));
+        } else {
+            throw new IllegalArgumentException("kafka extract node format is IllegalArgument");
+        }
+        if (StringUtils.isNotEmpty(getGroupId())) {
+            options.put(TdsqlKafkaConstant.PROPERTIES_GROUP_ID, getGroupId());
+        }
+        for (String key : getProperties().keySet()) {
+            options.put(key, getProperties().get(key));
+        }

Review Comment:
   It is duplication with code lines 72-74
   ```java
     if (getProperties() != null && !getProperties().isEmpty()) {
               options.putAll(getProperties());
           }
   ```



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r983413086


##########
inlong-common/src/main/java/org/apache/inlong/common/enums/TaskTypeEnum.java:
##########
@@ -31,8 +31,10 @@ public enum TaskTypeEnum {
     MONGODB(9),
     TUBEMQ(10),
     REDIS(11),
-
-
+    CKAFKA(12),
+    MYSQL(13),

Review Comment:
   Excuse me, what does the difference between the `SQL`, `BINLOG`, and `MYSQL`?



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984344725


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TDSQLKafkaExtractNode.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TDSQLKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka

Review Comment:
   ```suggestion
    * TDSQK Kafka extract node info
   ```



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow closed pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow closed pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector
URL: https://github.com/apache/inlong/pull/6067


-- 
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@inlong.apache.org

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


[GitHub] [inlong] yunqingmoswu commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
yunqingmoswu commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984188343


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/constant/TdsqlKafkaConstant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ *   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.inlong.sort.protocol.constant;
+
+/**
+ * tdsql kafka option constant
+ *
+ * @see <a href="https://cloud.tencent.com/document/product/849/71448"></a>
+ */
+public class TdsqlKafkaConstant {

Review Comment:
   Tdsql -> TDSQL



##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TdsqlKafkaExtractNode.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TdsqlKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka
+ */
+@EqualsAndHashCode(callSuper = true)
+@JsonTypeName("tdsqlKafkaExtract")
+public class TdsqlKafkaExtractNode extends KafkaExtractNode implements InlongMetric, Metadata, Serializable {

Review Comment:
   Tdsql -> TDSQL



-- 
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@inlong.apache.org

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


[GitHub] [inlong] gong commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
gong commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984189516


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TdsqlKafkaExtractNode.java:
##########
@@ -0,0 +1,96 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TdsqlKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka
+ */
+@EqualsAndHashCode(callSuper = true)
+@JsonTypeName("tdsqlKafkaExtract")
+public class TdsqlKafkaExtractNode extends KafkaExtractNode implements InlongMetric, Metadata, Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    public TdsqlKafkaExtractNode(@JsonProperty("id") String id,
+            @JsonProperty("name") String name,
+            @JsonProperty("fields") List<FieldInfo> fields,
+            @Nullable @JsonProperty("watermarkField") WatermarkField watermarkField,
+            @JsonProperty("properties") Map<String, String> properties,
+            @Nonnull @JsonProperty("topic") String topic,
+            @Nonnull @JsonProperty("bootstrapServers") String bootstrapServers,
+            @Nonnull @JsonProperty("format") Format format,
+            @JsonProperty("scanStartupMode") KafkaScanStartupMode kafkaScanStartupMode,
+            @JsonProperty("primaryKey") String primaryKey,
+            @JsonProperty("groupId") String groupId,
+            @JsonProperty("scanSpecificOffsets") String scanSpecificOffsets) {
+        super(id, name, fields, watermarkField, properties, topic, bootstrapServers, format, kafkaScanStartupMode,
+                primaryKey, groupId, scanSpecificOffsets);
+    }
+
+    /**
+     * generate table options
+     *
+     * @return options
+     */
+    @Override
+    public Map<String, String> tableOptions() {
+        Map<String, String> options = new LinkedHashMap<>();
+        if (getProperties() != null && !getProperties().isEmpty()) {
+            options.putAll(getProperties());
+        }
+        options.put(TdsqlKafkaConstant.TOPIC, getTopic());
+        options.put(TdsqlKafkaConstant.PROPERTIES_BOOTSTRAP_SERVERS, getBootstrapServers());
+        if (getFormat() instanceof ProtobufFormat) {
+            options.put(TdsqlKafkaConstant.CONNECTOR, TdsqlKafkaConstant.TDSQL_SUBSCRIBE);
+            options.put(TdsqlKafkaConstant.SCAN_STARTUP_MODE, getKafkaScanStartupMode().getValue());
+            if (StringUtils.isNotEmpty(getScanSpecificOffsets())) {
+                options.put(TdsqlKafkaConstant.SCAN_STARTUP_SPECIFIC_OFFSETS, getScanSpecificOffsets());
+            }
+            options.putAll(getFormat().generateOptions(false));
+        } else {
+            throw new IllegalArgumentException("kafka extract node format is IllegalArgument");
+        }

Review Comment:
   description should be `tdsql kafka extract node`



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r983414863


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/constant/TdsqlKafkaConstant.java:
##########
@@ -0,0 +1,41 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file

Review Comment:
   Please keep this license header the same as other files.



-- 
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@inlong.apache.org

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


[GitHub] [inlong] liaorui commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
liaorui commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r984183350


##########
inlong-common/src/main/java/org/apache/inlong/common/enums/TaskTypeEnum.java:
##########
@@ -31,8 +31,10 @@ public enum TaskTypeEnum {
     MONGODB(9),
     TUBEMQ(10),
     REDIS(11),
-
-
+    CKAFKA(12),
+    MYSQL(13),

Review Comment:
   delete MYSQL in line 35



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r983412228


##########
inlong-common/src/main/java/org/apache/inlong/common/enums/TaskTypeEnum.java:
##########
@@ -31,8 +31,10 @@ public enum TaskTypeEnum {
     MONGODB(9),
     TUBEMQ(10),
     REDIS(11),
-
-
+    CKAFKA(12),
+    MYSQL(13),
+    TDSQL_KAFKA(14),
+    DORIS(15)

Review Comment:
   ```suggestion
       DORIS(15),
   
   
   ```



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r983413982


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/format/ProtobufFormat.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.inlong.sort.protocol.node.format;
+
+import java.util.HashMap;
+import java.util.Map;
+import lombok.Data;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonCreator;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonIgnore;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+
+/**
+ * The protobuf format.
+ *
+ */
+@JsonTypeName("protobufFormat")
+@Data

Review Comment:
   ```suggestion
    */
   @Data
   @JsonTypeName("protobufFormat")
   ```



-- 
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@inlong.apache.org

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


[GitHub] [inlong] healchow commented on a diff in pull request #6067: [INLONG-6061][Sort] Support TDSQL-Kafka connector

Posted by GitBox <gi...@apache.org>.
healchow commented on code in PR #6067:
URL: https://github.com/apache/inlong/pull/6067#discussion_r990572823


##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/constant/TDSQLKafkaConstant.java:
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.inlong.sort.protocol.constant;
+
+/**
+ * tdsql kafka option constant

Review Comment:
   ```suggestion
    * TDSQL Kafka option constant
   ```



##########
inlong-sort/sort-common/src/main/java/org/apache/inlong/sort/protocol/node/extract/TDSQLKafkaExtractNode.java:
##########
@@ -0,0 +1,93 @@
+/*
+ * 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.inlong.sort.protocol.node.extract;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import lombok.EqualsAndHashCode;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonProperty;
+import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.annotation.JsonTypeName;
+import org.apache.inlong.sort.protocol.FieldInfo;
+import org.apache.inlong.sort.protocol.InlongMetric;
+import org.apache.inlong.sort.protocol.Metadata;
+import org.apache.inlong.sort.protocol.constant.TDSQLKafkaConstant;
+import org.apache.inlong.sort.protocol.enums.KafkaScanStartupMode;
+import org.apache.inlong.sort.protocol.node.format.Format;
+import org.apache.inlong.sort.protocol.node.format.ProtobufFormat;
+import org.apache.inlong.sort.protocol.transformation.WatermarkField;
+
+/**
+ * Kafka extract node for extract data from kafka

Review Comment:
   ```suggestion
    * TDSQL Kafka extract node info
   ```



-- 
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@inlong.apache.org

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