ruanwenjun commented on code in PR #1761:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1761#discussion_r860516993


##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/pom.xml:
##########
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-transforms-flink</artifactId>
+        <groupId>org.apache.seatunnel</groupId>
+        <version>2.1.1-SNAPSHOT</version>

Review Comment:
   ```suggestion
           <version>${revision}</version>
   ```
   



##########
docs/zh-CN/flink/configuration/transform-plugins/Replace.md:
##########
@@ -0,0 +1,94 @@
+# Replace

Review Comment:
   There is no need to provide Chinese documentation, We will find a tool to 
help generate the Chinese documentation, we have already discussed in this 
[mail thread ](https://lists.apache.org/thread/j1vo1yccqp79bv69bzokbqq3n58zytql)



##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/src/main/java/org/apache/seatunnel/flink/transform/Replace.java:
##########
@@ -0,0 +1,80 @@
+package org.apache.seatunnel.flink.transform;

Review Comment:
   Missing Apache license header.



##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/pom.xml:
##########
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-transforms-flink</artifactId>
+        <groupId>org.apache.seatunnel</groupId>
+        <version>2.1.1-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>seatunnel-transform-flink-replace</artifactId>
+
+    <properties>
+        <junit.version>4.4</junit.version>

Review Comment:
   We have defined the JUnit version in root `pom.xml`, so you don't need to 
define a version here, this will make it hard to manage the version.



##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/src/main/java/org/apache/seatunnel/flink/transform/ScalarReplace.java:
##########
@@ -0,0 +1,35 @@
+package org.apache.seatunnel.flink.transform;

Review Comment:
   Missing Apache license header.



##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/src/main/java/org/apache/seatunnel/flink/transform/Replace.java:
##########
@@ -0,0 +1,80 @@
+package org.apache.seatunnel.flink.transform;
+
+import org.apache.flink.api.java.DataSet;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.types.Row;
+import org.apache.seatunnel.common.config.CheckConfigUtil;
+import org.apache.seatunnel.common.config.CheckResult;
+import org.apache.seatunnel.flink.FlinkEnvironment;
+import org.apache.seatunnel.flink.batch.FlinkBatchTransform;
+import org.apache.seatunnel.flink.stream.FlinkStreamTransform;
+import org.apache.seatunnel.shade.com.typesafe.config.Config;
+
+public class Replace implements FlinkStreamTransform, FlinkBatchTransform {
+
+    private Config config;
+
+    private static final String PATTERN = "pattern";
+    private static final String REPLACEMENT = "replacement";
+    private static final String ISREGEX = "is_regex";
+    private static final String REPLACEFIRST = "replace_first";
+
+    private String pattern = "";
+    private String replacement = "";
+    private Boolean isRegex = false;
+    private Boolean replaceFirst = false;
+
+
+    @Override
+    public void setConfig(Config config) {
+        this.config = config;
+    }
+
+    @Override
+    public Config getConfig() {
+        return config;
+    }
+
+    @Override
+    public CheckResult checkConfig() {
+        return CheckConfigUtil.checkAllExists(config);

Review Comment:
   You may need to add which config key you want to check.



##########
docs/en/transform/replace.md:
##########
@@ -1,16 +1,17 @@
-# Json
+# Replace
 
 ## Description
 
-Examines string value in a given field and replaces substring of the string 
value that matches the given string literal or regexes with the given 
replacement.
+Examines string value in a given field and replaces substring of the string 
value that matches the given string literal
+or regexes with the given replacement.
 
 :::tip
 
-This transform **ONLY** supported by Spark.
+This transform can supported by Spark and Flink,There are slight differences 
between the two engine configuration items.
 
 :::
 
-## Options
+## Options(Spark)

Review Comment:
   It's better to use `<Tabs>` to manage the parameters in different engine. 
And it would be better to implement this plugin with same parameters in 
different engine.
   



##########
seatunnel-transforms/seatunnel-transforms-flink/seatunnel-transform-flink-replace/src/test/java/org/apache/seatunnel/flink/transform/TestReplace.java:
##########
@@ -0,0 +1,48 @@
+package org.apache.seatunnel.flink.transform;

Review Comment:
   Missing Apache license header.



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