You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "rewerma (via GitHub)" <gi...@apache.org> on 2023/01/31 03:11:58 UTC

[GitHub] [incubator-seatunnel] rewerma opened a new pull request, #4012: Add Deduplicate Transform for internal engine

rewerma opened a new pull request, #4012:
URL: https://github.com/apache/incubator-seatunnel/pull/4012

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   Add Deduplicate transform for  the internal engine, for example configuration: 
   
   ```
   source {
     Jdbc {
         url = "jdbc:mysql://localhost:3306/foo"
         driver = "com.mysql.cj.jdbc.Driver"
         connection_check_timeout_sec = 100
         user = "root"
         password = "******"
         # Must sort by the column of deduplicate
         query = "select id, name, c_time from fake order by name, id"
     }
   }
   
   transform {
     Deduplicate {
       duplicate_fields = ["name"]
     }
   }
   
   sink {
     Console {}
   }
   ```
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/incubator-seatunnel/tree/dev/docs/en/connector-v2)
     2. Update [plugin-mapping.properties](https://github.com/apache/incubator-seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     3. Update the pom file of [seatunnel-dist](https://github.com/apache/incubator-seatunnel/blob/dev/seatunnel-dist/pom.xml)
   * [ ] Update the [`release-note`](https://github.com/apache/incubator-seatunnel/blob/dev/release-note.md).


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


[GitHub] [incubator-seatunnel] rewerma commented on a diff in pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine

Posted by "rewerma (via GitHub)" <gi...@apache.org>.
rewerma commented on code in PR #4012:
URL: https://github.com/apache/incubator-seatunnel/pull/4012#discussion_r1095535497


##########
docs/en/transform-v2/deduplicate.md:
##########
@@ -0,0 +1,84 @@
+# Deduplicate
+
+> Deduplicate transform plugin
+
+## Description
+
+Deduplicate rows by specified fields.
+
+## Options
+
+| name                 | type  | required | default value |
+|----------------------| ----- | -------- |---------------|
+| duplicate_fields     | array | yes      |               |
+
+### duplicate_fields [array]
+
+Duplicate rows by the field of array
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Example
+
+The data read from source is a table like this:
+
+| id | name     | age | 
+|----|----------|-----|
+| 1  | Joy Ding | 20  | 
+| 5  | Joy Ding | 20  | 
+| 2  | Kin Dom  | 14  | 
+| 9  | Kin Dom  | 14  |
+
+The source table data must sort by duplicate fields. For example, JDBC source:

Review Comment:
   It is unsupported for the partitioned data yet, unless the data partitioned by the duplicate fields first.



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


[GitHub] [incubator-seatunnel] rewerma closed pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine

Posted by "rewerma (via GitHub)" <gi...@apache.org>.
rewerma closed pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine
URL: https://github.com/apache/incubator-seatunnel/pull/4012


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


[GitHub] [incubator-seatunnel] EricJoy2048 commented on a diff in pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine

Posted by "EricJoy2048 (via GitHub)" <gi...@apache.org>.
EricJoy2048 commented on code in PR #4012:
URL: https://github.com/apache/incubator-seatunnel/pull/4012#discussion_r1099768605


##########
docs/en/transform-v2/deduplicate.md:
##########
@@ -0,0 +1,84 @@
+# Deduplicate
+
+> Deduplicate transform plugin
+
+## Description
+
+Deduplicate rows by specified fields.
+
+## Options
+
+| name                 | type  | required | default value |
+|----------------------| ----- | -------- |---------------|
+| duplicate_fields     | array | yes      |               |
+
+### duplicate_fields [array]
+
+Duplicate rows by the field of array
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Example
+
+The data read from source is a table like this:
+
+| id | name     | age | 
+|----|----------|-----|
+| 1  | Joy Ding | 20  | 
+| 5  | Joy Ding | 20  | 
+| 2  | Kin Dom  | 14  | 
+| 9  | Kin Dom  | 14  |
+
+The source table data must sort by duplicate fields. For example, JDBC source:

Review Comment:
   > When the data is partitioned, multiple transform objects will be created to read in parallel, and the data will be partitioned first and then sorted
   
   +1



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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #4012:
URL: https://github.com/apache/incubator-seatunnel/pull/4012#discussion_r1099770238


##########
docs/en/transform-v2/deduplicate.md:
##########
@@ -0,0 +1,84 @@
+# Deduplicate
+
+> Deduplicate transform plugin
+
+## Description
+
+Deduplicate rows by specified fields.
+
+## Options
+
+| name                 | type  | required | default value |
+|----------------------| ----- | -------- |---------------|
+| duplicate_fields     | array | yes      |               |
+
+### duplicate_fields [array]
+
+Duplicate rows by the field of array
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Example
+
+The data read from source is a table like this:
+
+| id | name     | age | 
+|----|----------|-----|
+| 1  | Joy Ding | 20  | 
+| 5  | Joy Ding | 20  | 
+| 2  | Kin Dom  | 14  | 
+| 9  | Kin Dom  | 14  |
+
+The source table data must sort by duplicate fields. For example, JDBC source:

Review Comment:
   too restrictive



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


[GitHub] [incubator-seatunnel] hailin0 commented on a diff in pull request #4012: [Feature] [Transform-V2]Add Deduplicate Transform for internal engine

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #4012:
URL: https://github.com/apache/incubator-seatunnel/pull/4012#discussion_r1094048774


##########
docs/en/transform-v2/deduplicate.md:
##########
@@ -0,0 +1,84 @@
+# Deduplicate
+
+> Deduplicate transform plugin
+
+## Description
+
+Deduplicate rows by specified fields.
+
+## Options
+
+| name                 | type  | required | default value |
+|----------------------| ----- | -------- |---------------|
+| duplicate_fields     | array | yes      |               |
+
+### duplicate_fields [array]
+
+Duplicate rows by the field of array
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Example
+
+The data read from source is a table like this:
+
+| id | name     | age | 
+|----|----------|-----|
+| 1  | Joy Ding | 20  | 
+| 5  | Joy Ding | 20  | 
+| 2  | Kin Dom  | 14  | 
+| 9  | Kin Dom  | 14  |
+
+The source table data must sort by duplicate fields. For example, JDBC source:

Review Comment:
   The source table data must partition by duplicate fields.



##########
seatunnel-e2e/seatunnel-transforms-v2-e2e/src/test/resources/deduplicate_transform.conf:
##########
@@ -0,0 +1,70 @@
+#
+# 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.
+#
+######
+###### This config file is a demonstration of streaming processing in seatunnel config
+######
+
+env {
+  job.mode = "BATCH"
+}
+
+source {
+  FakeSource {
+    result_table_name = "fake"
+    schema = {
+      fields {
+        id = "int"
+        name = "string"
+        age = "int"
+      }
+    }
+    # The source data must sorted by duplication fields
+    rows = [
+      { fields = [1, "Eric", 21], kind = "INSERT" }
+      { fields = [5, "Eric", 21], kind = "INSERT" }
+      { fields = [2, "Alex", 36], kind = "INSERT" }
+      { fields = [9, "Alex", 36], kind = "INSERT" }
+      { fields = [3, "Eddie", 36], kind = "INSERT" }
+    ]

Review Comment:
   add testcase
   `
   { fields = [1, "A", 21], kind = "INSERT" }
   { fields = [2, "B", 36], kind = "INSERT" }
   { fields = [5, "A", 21], kind = "INSERT" }
   `



##########
docs/en/transform-v2/deduplicate.md:
##########
@@ -0,0 +1,84 @@
+# Deduplicate
+
+> Deduplicate transform plugin
+
+## Description
+
+Deduplicate rows by specified fields.
+
+## Options
+
+| name                 | type  | required | default value |
+|----------------------| ----- | -------- |---------------|
+| duplicate_fields     | array | yes      |               |
+
+### duplicate_fields [array]
+
+Duplicate rows by the field of array
+
+### common options [string]
+
+Transform plugin common parameters, please refer to [Transform Plugin](common-options.md) for details
+
+## Example
+
+The data read from source is a table like this:
+
+| id | name     | age | 
+|----|----------|-----|
+| 1  | Joy Ding | 20  | 
+| 5  | Joy Ding | 20  | 
+| 2  | Kin Dom  | 14  | 
+| 9  | Kin Dom  | 14  |
+
+The source table data must sort by duplicate fields. For example, JDBC source:

Review Comment:
   When the data is partitioned, multiple transform objects will be created to read in parallel, and the data will be partitioned first and then sorted



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