ruanwenjun commented on code in PR #1880:
URL:
https://github.com/apache/incubator-seatunnel/pull/1880#discussion_r873446253
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-fake/src/main/java/org/apache/seatunnel/flink/fake/source/FakeSource.java:
##########
@@ -62,13 +71,15 @@ public String getPluginName() {
@Override
public DataSet<Row> getData(FlinkEnvironment env) {
- Random random = new Random();
- return env.getBatchTableEnvironment().toDataSet(
- env.getBatchTableEnvironment().fromValues(
- DataTypes.ROW(DataTypes.FIELD("name", DataTypes.STRING()),
- DataTypes.FIELD("age", DataTypes.INT())),
- Arrays.stream(NAME_ARRAY).map(n -> Row.of(n,
random.nextInt(AGE_LIMIT)))
- .collect(Collectors.toList())), Row.class);
+ List<Row> dataSet = new ArrayList<>(0);
Review Comment:
```suggestion
List<Row> dataSet = new ArrayList<>(mockDataSize);
```
##########
docs/en/connector/source/Fake.mdx:
##########
@@ -127,6 +221,7 @@ source {
FakeSource {
result_table_name = "fake"
field_name = "name,age"
+ mock_data_size = 100 // data will mock until count is 100.
Review Comment:
```suggestion
mock_data_size = 100 // will generate 100 rows mock data.
```
##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-fake/pom.xml:
##########
@@ -49,6 +49,11 @@
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.github.jsonzou</groupId>
+ <artifactId>jmockdata</artifactId>
+ <version>4.3.0</version>
Review Comment:
Please use `dependencyManagement` to manage the dependency version.
##########
docs/en/connector/source/Fake.mdx:
##########
@@ -111,11 +173,43 @@ The generated data is as follows, randomly extract the
string from the `content`
### FakeSourceStream
+
+
```bash
source {
FakeSourceStream {
result_table_name = "fake"
field_name = "name,age"
+ //mock_data_schema = [
+ //{
+ // name = "name"
+ // type = "string"
+ // mock_config = { //see https://github.com/jsonzou/jmockdata, next
is all kind config, not all configurations are required
+ // byte_range = [0,127] // byte value will mock range between 0
and 127.
+ // boolean_seed = [true, true, false] // boolean value will
mock random in this array.
+ // char_seed = ['a','b','c'] // char value will mock random in
this array.
+ // date_range = ["1970-01-01", "2100-12-31"] // date value will
mock random in this array.
+ // decimal_scale = 2 // decimal's scale is 2
+ // double_range = [0.0, 10000.0] // double value will mock range
between 0.0 and 10000.0.
+ // float_range = [0.0, 10000.0] // float value will mock range
between 0.0 and 10000.0.
+ // int_range = [0, 100] // int value will mock range between 0
and 100.
+ // long_range = [0, 100000] // long value will mock range
between 0 and 100000.
Review Comment:
Please remove these comments.
--
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]